[
https://issues.jboss.org/browse/JBIDE-7875?page=com.atlassian.jira.plugin...
]
Dan Allen commented on JBIDE-7875:
----------------------------------
Just to clarify when you need an AnnotationLiteral, it's sort of like a constructor
for an annotation, since you can't easily create an annotation otherwise. You'd
use it for programmatic selection of beans. For instance, consider the case when you need
to fire an event.
@Inject Event<Document> documentEvent;
...
documentEvent.select(new UpdatedLiteral()).fire(documentEvent);
Though, for any annotation that has no attributes, the wizard should automatically create
a static INSTANCE field as an optimization. That would allow:
documentEvent.select(UpdatedLiteral.INSTANCE).fire(documentEvent);
And to provide a little more background, creating annotation literals and the static
INSTANCE field (in cases where the annotation has no attributes) are coding conventions in
Seam.
Wizard for creating an AnnotationLiteral
----------------------------------------
Key: JBIDE-7875
URL:
https://issues.jboss.org/browse/JBIDE-7875
Project: Tools (JBoss Tools)
Issue Type: Feature Request
Components: cdi (jsr-299)
Reporter: Dan Allen
Assignee: Viacheslav Kabanovich
Fix For: 3.2.0.CR1
Attachments: New Annotation Literal.png
We are recommending to developers, particularly extension designers, that they create an
AnnotationLiteral for every qualifier in their public API. Creating an AnnotationLiteral
can be a tad tedious. Thus, we should introduce a wizard to create them in JBT.
Here's a whole bunch of annotation literals to use as a reference:
https://github.com/weld/extensions/tree/1.0.0.Beta1/impl/src/main/java/or...
The real time saver is creating an AnnotationLiteral for an Annotation (qualifier) that
has attributes.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira