[
https://issues.jboss.org/browse/CDI-485?page=com.atlassian.jira.plugin.sy...
]
Martin Kouba commented on CDI-485:
----------------------------------
I'm going to add literals for:
* {{javax.enterprise.inject.Any}}
* {{javax.enterprise.inject.Default}}
* {{javax.enterprise.inject.New}}
* {{javax.enterprise.util.Nonbinding}}
* {{javax.enterprise.context.Initialized}}
* {{javax.enterprise.context.Destroyed}}
* {{javax.enterprise.context.RequestScoped}}
* {{javax.enterprise.context.SessionScoped}}
* {{javax.enterprise.context.ApplicationScoped}}
* {{javax.enterprise.context.Dependent}}
* {{javax.enterprise.context.ConversationScoped}}
* {{javax.enterprise.inject.Alternative}}
* {{javax.enterprise.inject.Typed}}
* {{javax.inject.Named}}
* {{javax.inject.Qualifier}}
* {{javax.inject.Singleton}}
Any other tips?
If possible I will place the literal as a static nested class inside the annotation
definition (as Jozef suggested), so that one could use {{Any.Literal.INSTANCE}} or
{{Initialized.Literal.of(RequestScoped.class)}}.
Provide literals for built-in annotations
-----------------------------------------
Key: CDI-485
URL:
https://issues.jboss.org/browse/CDI-485
Project: CDI Specification Issues
Issue Type: Feature Request
Affects Versions: 1.2.Final
Reporter: Jozef Hartinger
Assignee: Martin Kouba
Annotation literals are often useful and therefore many projects implement them
themselves. For example:
https://github.com/apache/deltaspike/blob/master/deltaspike/core/api/src/...
https://github.com/weld/core/blob/master/impl/src/main/java/org/jboss/wel...
https://github.com/forge/furnace-cdi/blob/master/impl/src/main/java/org/j...
https://github.com/astefanutti/metrics-cdi/blob/master/impl/src/main/java...
to name a few.
It would be nice to provide these within the CDI API, e.g:
{code:JAVA}
@Target( { TYPE, METHOD, PARAMETER, FIELD })
@Retention(RUNTIME)
@Documented
@Qualifier
public @interface Default {
@SuppressWarnings("all")
final class Literal extends AnnotationLiteral<Default> implements Default {
private Literal() {
}
}
final Default INSTANCE = new Literal();
}
{code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)