[cdi-dev] [JBoss JIRA] (CDI-485) Provide literals for built-in annotations

Antoine Sabot-Durand (JIRA) issues at jboss.org
Fri Feb 12 10:49:00 EST 2016


    [ https://issues.jboss.org/browse/CDI-485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13162338#comment-13162338 ] 

Antoine Sabot-Durand commented on CDI-485:
------------------------------------------

And what about {{INSTANCE}} for annotations having members like {{@New}}, {{@Typed}}, {{@Destroyed}} or {{@Initialized}} ?

> 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/main/java/org/apache/deltaspike/core/api/literal/DefaultLiteral.java
> https://github.com/weld/core/blob/master/impl/src/main/java/org/jboss/weld/literal/DefaultLiteral.java
> https://github.com/forge/furnace-cdi/blob/master/impl/src/main/java/org/jboss/forge/furnace/container/cdi/util/DefaultLiteral.java
> https://github.com/astefanutti/metrics-cdi/blob/master/impl/src/main/java/io/astefanutti/metrics/cdi/DefaultLiteral.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)


More information about the cdi-dev mailing list