[cdi-dev] [JBoss JIRA] (CDI-407) Specifiy @Named @Alternatives

Mark Struberg (JIRA) issues at jboss.org
Mon Oct 20 10:38:36 EDT 2014


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

Mark Struberg commented on CDI-407:
-----------------------------------

I agree with Martin that the Name must be explicitly given.

I think the example which makes most sense is not inheritance but ipmlements
{code}
@Named public class A implements X
@Named("a") @Alternative public class B implements X
{code}

Not sure which restrictions we have to define to get this properly working though. E.g. having different interfaces (or no extends) would render this illegal imo. But only at runtime as we cannot check those conditions for EL like we do for InjectionPoints.
We need to think about it a bit.


> Specifiy @Named @Alternatives
> -----------------------------
>
>                 Key: CDI-407
>                 URL: https://issues.jboss.org/browse/CDI-407
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>          Components: Beans, Inheritance and Specialization
>            Reporter: Thomas Andraschko
>
> It's actually a must-have for product development and a common case.
> We would like to have multiple implementations in our core and just activate them via alternative.
> I talked with struberg and its currently not defined in the specs.
> e.g.
> @Named public class A
> @Named @Alternative public class B extends A
> What should acutally happen if B is activated via beans.xml?
> IMO B should be available in EL via "a" and "b".



--
This message was sent by Atlassian JIRA
(v6.3.1#6329)


More information about the cdi-dev mailing list