[forge-issues] [JBoss JIRA] (ROASTER-44) Support writing of nested annotation arrays
George Gastaldi (JIRA)
issues at jboss.org
Wed Nov 19 07:15:41 EST 2014
[ https://issues.jboss.org/browse/ROASTER-44?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13021111#comment-13021111 ]
George Gastaldi edited comment on ROASTER-44 at 11/19/14 7:15 AM:
------------------------------------------------------------------
I am using your changes on FORGE-2138, however, I am having a bad time trying to add an annotation based on a {{Class<? extends java.lang.annotation.Annotation> type}} (like the {{@NamedQueries}} example in the issue description.
I think we might need the following methods:
{code:java}
/**
* Add a named annotation value. When there is no existing annotation or annotation array value for {@code name}, a
* single unwrapped annotation value will be created (as with {@link #setAnnotationValue(String)}); otherwise an
* unwrapped annotation value will be promoted to an array and a new element will be added.
*
* @return the nested {@link AnnotationSource}
*/
AnnotationSource<O> addAnnotationValue(Class<? extends java.lang.annotation.Annotation> type);
/**
* Add a named annotation value. When there is no existing annotation or annotation array value for {@code name}, a
* single unwrapped annotation value will be created (as with {@link #setAnnotationValue(String)}); otherwise an
* unwrapped annotation value will be promoted to an array and a new element will be added.
*
* @param name
* @return the nested {@link AnnotationSource}
*/
AnnotationSource<O> addAnnotationValue(String name, Class<? extends java.lang.annotation.Annotation> type);
{code}
Thoughts?
was (Author: gastaldi):
I am using your changes on FORGE-2138, however, I am having a bad time trying to add an annotation based on a {{Class<? extends java.lang.annotation.Annotation> type}} (like the {{@NamedQueries}} example in the issue description.
I think we might need the following methods:
{code:java}
/**
* Add a named annotation value. When there is no existing annotation or annotation array value for {@code name}, a
* single unwrapped annotation value will be created (as with {@link #setAnnotationValue(String)}); otherwise an
* unwrapped annotation value will be promoted to an array and a new element will be added.
*
* @param name
* @return the nested {@link AnnotationSource}
*/
AnnotationSource<O> addAnnotationValue(Class<? extends java.lang.annotation.Annotation> type);
/**
* Add a named annotation value. When there is no existing annotation or annotation array value for {@code name}, a
* single unwrapped annotation value will be created (as with {@link #setAnnotationValue(String)}); otherwise an
* unwrapped annotation value will be promoted to an array and a new element will be added.
*
* @param name
* @return the nested {@link AnnotationSource}
*/
AnnotationSource<O> addAnnotationValue(String name, Class<? extends java.lang.annotation.Annotation> type);
{code}
Thoughts?
> Support writing of nested annotation arrays
> -------------------------------------------
>
> Key: ROASTER-44
> URL: https://issues.jboss.org/browse/ROASTER-44
> Project: Roaster
> Issue Type: Feature Request
> Components: API, JDT
> Affects Versions: 2.9.0.Final
> Reporter: George Gastaldi
> Assignee: Matt Benson
> Fix For: 2.9.1.Final
>
>
> Roaster should allow annotation nesting, like:
> {code}
> @NamedQueries({
> @NamedQuery(name="Customer.findAll", query="select C from Customer C"),
> @NamedQuery(name="Customer.findByName", query="select C from Customer C where C.name = :name"),
> @NamedQuery(name="Customer.findById", query="select C from Customer C where C.id = :id")
> })
> @Entity
> public class Customer {...}
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.8#6338)
More information about the forge-issues
mailing list