1 Reply Latest reply on Apr 1, 2005 3:50 PM by Adrian Brock

    change in ClassAdapter to support annotation overrides.

    Bill Burke Master

      I think the ClassAdapter API should change to more easily support annotation overrides:

      instead of

      ClassAdapter.getClassInfo();

      ClassAdapter.getClassInfo(BeanMetaData);

      BeanMetaData should have the overrides within it correct? Then the ClassAdapter can create teh ClassInfo with this information embedded into it.

      This will also help tremendously if the Kernel is going to look for annotations that create dependencies.

        • 1. Re: change in ClassAdapter to support annotation overrides.
          Adrian Brock Master

          There are a number of problems with that approach,
          but I'm open to suggestions if you have a cleaner solution.

          1) Class vs Bean abstraction

          ClassAdapter is in container whereas BeanMetaData is part of kernel.

          Also BeanMetaData deals with properties, e.g.

          <property name="whatever">
           <annotation name="SecurityRoles" value="Manager"/>
          </property>
          


          Whereas the ClassAdaptor would only know about fields or getter/setters.

          There is an impedence between the plain class model and the javabean model.

          2) Controlling instances

          How are you told/remember you want a class level or instance level ClassAdapter/JoinpointFactory.

          3) The type model is not restricted to the top level beans

          The kernel also needs to get hold of ClassInfo objects for configuration like:
          <bean class="MyClass">
           <property name="array">
           <array type="java.net.URL">
           <value>http://localhost:8080</value>
          </>
          


          Ideally, I want to use the same class model and joinpoint model for
          both the "class=" and "type="
          rather than having to do it in different ways depending on
          which part of the metadata it appears.

          So I want some hook into the ClassInfos even when it is not BeanMetaData.

          The problem is essential how does the value metadata handle the following:
           /**
           * Get the value.
           *
           * @param info the type info
           * @return the value.
           * @throws Throwable for any error
           */
           Object getValue(TypeInfo info) throws Throwable;
          


          when the value metadata could be StringValueMetaData or CollectionValueMetaData
          or XXXXValueMetaData that creates values/Objects based on whatever rules you like
          but it still needs to know the target type, either from the property itself or it is told it
          in the case that you want to be explicit and use a specific concrete implementation.

          public List getWhatever();
          public void setWhatever(List);
           <property name="whatever" type="java.util.ArrayList">
          ...
          


          See also:
          http://jira.jboss.com/jira/browse/JBMICROCONT-29