Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-436

JavaSource needs a way to parse nested annotations

XMLWordPrintable

      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.

              mbenson_jira Matt Benson (Inactive)
              kennardconsulting Richard Kennard (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: