"adrian(a)jboss.org" wrote :
| e.g. You've reused the MetaDataVisitors to do what?
| They look at the MetaData object not the real object graph how does this relate to
annotations are you talking about the annotations in the xml?
|
After you add new MetaData, it needs to be 'visited', in order to plugin all those
dependencies, callbacks, installs, ...
So the easiest way for me to do that was to use the existing MetaDataVisitor concept, and
just twist it a bit to suite my need - not starting from BeanMetaData, but on newly added
MetaDataVisitorNode + pushing BMD at the bottom of the stack before executing it.
"adrian(a)jboss.org" wrote :
| Why would the annotations be already processed?
|
When we do a re-install on the controller context, do we need a new look at the
annotations?
"adrian(a)jboss.org" wrote :
| I can say from that code that was broken,
| I don't like the idea of hardwiring those annotation handlers
|
This can easily be fixed, just temp impl detail.
Basically you have two kinds on annotations handlers - plugins and adapters.
Plugins are those who know how to handle class, constructor, method (property), field
annotations.
Adapters (Annotation2ValueMetaDataAdapter) are those who know how to produce ValueMetaData
from annotation.
Since property plugins == adapters, there is just one need for actual impl.
"adrian(a)jboss.org" wrote :
| How does one add ImplementationDetail3Adapter or use
| AlternateImplementationDetail1Adapter.INSTANCE.
There is a BeanAnnotationAdapter (uf, yup, bad choice of name) factory.
Some simple extension impl can be easily added.
| public class BeanAnnotationAdapterFactory
| {
| private static final BeanAnnotationAdapter adapter = new
BasicBeanAnnotationAdapter();
|
| public static BeanAnnotationAdapter getBeanAnnotationAdapter()
| {
| return adapter;
| }
| }
|
|
You can extend BasicBeanAnnotationAdapter and use its addPlugin method to add your new
annotation plugins.
| protected void addAnnotationPlugin(AnnotationPlugin plugin)
| {
| Class<? extends Annotation> annotation = plugin.getAnnotation();
| if (annotation.getAnnotation(Target.class) == null)
| log.warn("Annotation " + annotation + " missing @Target
annotation!");
| if (annotation.getAnnotation(Retention.class) == null)
| log.warn("Annotation " + annotation + " missing @Retention
annotation!");
|
| Set supported = plugin.getSupportedTypes();
| if (supported.contains(ElementType.TYPE))
| {
| classAnnotationPlugins.add(plugin);
| }
| if (supported.contains(ElementType.CONSTRUCTOR))
| {
| constructorAnnotationPlugins.add(plugin);
| }
| if (supported.contains(ElementType.METHOD))
| {
| if (plugin instanceof PropertyAware)
| propertyAnnotationPlugins.add(plugin);
| else
| methodAnnotationPlugins.add(plugin);
| }
| if (supported.contains(ElementType.FIELD))
| {
| fieldAnnotationPlugins.add(plugin);
| }
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070658#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...