[forge-issues] [JBoss JIRA] (FORGE-436) JavaSource needs a way to parse nested annotations

Richard Kennard (JIRA) jira-events at lists.jboss.org
Tue Jan 17 23:23:18 EST 2012


Richard Kennard created FORGE-436:
-------------------------------------

             Summary: JavaSource needs a way to parse nested annotations
                 Key: FORGE-436
                 URL: https://issues.jboss.org/browse/FORGE-436
             Project: Forge
          Issue Type: Feature Request
            Reporter: Richard Kennard


Currently, if presented with a Java file like this:

public class MockAnnotatedMethod {

   @MockAnnotation( anAnnotation = @AnotherMockAnnotation(43)),
   public MockAnnotatedMethod() {
   }
}

JavaSource can easily parse @MockAnnotation into org.jboss.forge.parser.java.Annotation. But then calling...

   annotationSource.getLiteralValue("anAnnotation")

...results in the String...

   "@AnotherMockAnnotation(43)"

There doesn't appear to be a good way to parse this String into another org.jboss.forge.parser.java.Annotation, complete with initializing its value to be '43'.

This is needed for Metawidget. Metawidget's inspectors can be written to inspect arbitrary metadata. It is feasible (though not currently required) that someone might want to parse:

@AttributeOverride( name = "name", column = @Column( name = "name", nullable = false ) )
public class Person {
   ...
}

This is a JPA annotation that makes the 'name' field a 'required' field, but to do so it uses nested annotations.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the forge-issues mailing list