2 Replies Latest reply on Mar 17, 2008 9:01 AM by alesj

    KernelScopeInfo and property annotations

    alesj

      With this addition to field injection (http://www.jboss.org/index.html?module=bb&op=viewtopic&t=131615), KernelScopeInfo needs changing of the way we add instance annotations.

       Set<PropertyInfo> propertyInfos = beanInfo.getProperties();
       if (propertyInfos != null && propertyInfos.size() > 0)
       {
       for (PropertyInfo propertyInfo : propertyInfos)
       {
       if (propertyInfo.getName().equals(propertyMetaData.getName()))
       {
       MethodInfo methodInfo = propertyInfo.getGetter();
       if (methodInfo != null)
       addAnnotations(classloader, mutable, methodInfo, propertyAnnotations);
       methodInfo = propertyInfo.getSetter();
       if (methodInfo != null)
       addAnnotations(classloader, mutable, methodInfo, propertyAnnotations);
       }
       }
       }
      

      We can add getGetterSignature and getSetterSignature on the PropertyInfo. Where in the case of FieldPI we would return FieldSignature for getSetterSignature and null for getGetterSignature.
      But that would mean introducing cyclic dependency on MDR project. :-(

      And the property lookup code should be changed to use BeanInfo.getProperty(name), unless we want to add annotations to all equally named propertys.

        • 1. Re: KernelScopeInfo and property annotations

          You should just add a "getFieldInfo" to the PropertyInfo.
          It's then just another "if" statement.

          This code is ugly anyway, it is this way because aop has no notion of "property"
          instead the annotations must be stored against the "joinpoint", i.e. getters/setters
          and now fields.

          • 2. Re: KernelScopeInfo and property annotations
            alesj

             

            "adrian@jboss.org" wrote:
            You should just add a "getFieldInfo" to the PropertyInfo.
            It's then just another "if" statement.

            This code is ugly anyway, it is this way because aop has no notion of "property"
            instead the annotations must be stored against the "joinpoint", i.e. getters/setters
            and now fields.

            Plain ugly, but effective. :-)