Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support JavaDoc comment to an annotation element #271

Closed
gastaldi opened this issue Nov 8, 2022 Discussed in #270 · 0 comments · Fixed by #272
Closed

Support JavaDoc comment to an annotation element #271

gastaldi opened this issue Nov 8, 2022 Discussed in #270 · 0 comments · Fixed by #272

Comments

@gastaldi
Copy link
Member

gastaldi commented Nov 8, 2022

Discussed in #270

Originally posted by rob-stoecklein November 8, 2022
When creating an annotation type, how do we set the JavaDoc for an element?
In the example below, it's the JAVADOC TEXT.

    /**
     * Trying to build the following annotation:
     * 
     * public @interface MyAnnotation {
     *
     *     /**
     *      * JAVADOC TEXT
     *      */
     *     String element;
     * }
     */
    public static void main(final String[] args) {
        final JavaAnnotationSource output = Roaster.create(JavaAnnotationSource.class);
        output.setName("MyAnnotation");

        final AnnotationElementSource annotationElementSource = output.addAnnotationElement();
        annotationElementSource.setName("element");
        annotationElementSource.setType("String");
        //annotationElementSource.getJavaDoc().setFullText("JAVADOC TEXT");  // <== Expecting a call like this

        final String outputStr = Roaster.format(output.toString());
        System.out.println(outputStr);
    }

How can we get this to work?
Thanks!

gastaldi added a commit that referenced this issue Nov 8, 2022
gastaldi added a commit that referenced this issue Nov 8, 2022
gastaldi added a commit that referenced this issue Nov 9, 2022
gastaldi added a commit that referenced this issue Nov 9, 2022
gastaldi added a commit that referenced this issue Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant