1 2 Previous Next 16 Replies Latest reply on Feb 7, 2007 5:34 AM by alesj Go to original post
      • 15. Re: Property replacement
        alesj

         


        There already is an AnnotationInfo. Doesn't the inherrited TypeInfo.convertValue(Object value, boolean replaceProperties) come into play?


        If we wanted to use this, it probably means that we should push the replace param with the current Annotation creation:
        ann = (Annotation) AnnotationCreator.createAnnotation(annString, Thread.currentThread().getContextClassLoader());
        


        But I don't see any easy way to call AnnotationInfo.convertValue(Object, boolean).

        • 16. Re: Property replacement
          alesj

          I've added simple property replace to annotations def (the thing that was bothering Brian):

           String annString = annotation;
           // TODO - JBMICROCONT-143 + any better way?
           if (replace)
           {
           annString = StringPropertyReplacer.replaceProperties(annString);
           }
           //FIXME [JBMICROCONT-99] [JBAOP-278] Use the loader for the bean?
           ann = (Annotation)AnnotationCreator.createAnnotation(annString, Thread.currentThread().getContextClassLoader());
          


          If there is any better idea ...

          Btw, how does one get this:
          I have this bean via XML:
           <bean name="MyBeanReplace" class="org.jboss.test.kernel.config.support.MyObject">
           <annotation>@org.jboss.test.kernel.config.support.SimpleAnnotation(name = "test.${test.property.value}.Name")</annotation>
           </bean>
          


          And I would like to get its annotations in a classical way:
          MyObject mybean = ...;
          SimpleAnnotation ann = mybean.getClass().getAnnotation(SimpleAnnotation.class);
          


          What AOP things must I add to XML, so that my bean gets annotation 'aspect'?

          1 2 Previous Next