0 Replies Latest reply on Feb 18, 2010 8:45 PM by cvgaviao

    How to get the values of annotation's members?

    cvgaviao

      Hi people,

       

      I'm trying to learn to use javassist and I need some help with my study.

       

      I want first to get all annotations used from one class and its hierarchy (recursively until Object class) . Second, to create a Map<String, List<?>> for each annotation founded and get all annotation's members and its values for each class. And third, to merge all annotation's member whose types are array.

       

      Well I could do the first part,  but I've no lock on the second one. I couldn't found a way to get the members real values...

       

      I've used these method:

       

      {code}

      ...

       

      for (javassist.bytecode.annotation.Annotation testAnnotation : annotations) {

       

       

      ..

      Set<String> memberNames = testAnnotation.getMemberNames();

      for (String memberName : memberNames) {

      MemberValue value = testAnnotation.getMemberValue(memberNames);

      Class[] myRelatedClasses = value.???

      ...

      }

      {code}

       

      But I couldn't see any method on MemberValue that I could use to get the value. Actualy there is a method, but not public...

       

      Could someone give a clue how could I do that?

       

      thanks

       

      Cristiano