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

George Gastaldi (JIRA) jira-events at lists.jboss.org
Wed Aug 22 13:19:15 EDT 2012


     [ https://issues.jboss.org/browse/FORGE-436?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

George Gastaldi updated FORGE-436:
----------------------------------

    Fix Version/s: 2.0.0.Alpha1

    
> 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
>          Components: Parsers / File Manipulation
>    Affects Versions: 1.0.7.Final
>            Reporter: Richard Kennard
>             Fix For: 2.0.0.Alpha1
>
>
> 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