[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Adding applyMetaData method to KernelControllerContext

adrian@jboss.org do-not-reply at jboss.com
Fri Aug 3 11:21:51 EDT 2007


"alesj" wrote : "adrian at 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.
  | 

Ok. But I'm not sure it needs to be this complicated?

anonymous wrote : 
  | "adrian at 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?
  | 

Of course, the class could change.

anonymous wrote : 
  | "adrian at 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);
  |   |       }
  |   |    }
  |   | 

Ok. So the code that didn't compile was just out-of-the-box factory settings
for bootstrapping?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070671#4070671

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070671



More information about the jboss-dev-forums mailing list