[cdi-dev] [JBoss JIRA] (CDI-608) Fix generics used within addObserverMethod
John Ament (JIRA)
issues at jboss.org
Fri May 27 08:38:00 EDT 2016
[ https://issues.jboss.org/browse/CDI-608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13244000#comment-13244000 ]
John Ament commented on CDI-608:
--------------------------------
Not sure, what type does it need to be to support this?
> Fix generics used within addObserverMethod
> ------------------------------------------
>
> Key: CDI-608
> URL: https://issues.jboss.org/browse/CDI-608
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Reporter: John Ament
>
> the following code doesn’t compile:
> {code}
> cdiEventEndpoints.values().stream().forEach(endpoint -> abd.addObserverMethod()
> .beanClass(CdiEventComponent.class)
> .observedType(endpoint.getType())
> .qualifiers(endpoint.getQualifiers())
> .notifyWith(endpoint::notify);
> {code}
> I need to write:
> {code}
> cdiEventEndpoints.values().stream().forEach(endpoint -> addCdiEventObserver(abd, endpoint));
> private <T> void addCdiEventObserver(AfterBeanDiscovery abd, CdiEventEndpoint<T> endpoint) {
> abd.<T>addObserverMethod()
> .beanClass(CdiEventComponent.class)
> .observedType(endpoint.getType())
> .qualifiers(endpoint.getQualifiers())
> .notifyWith(endpoint::notify);
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the cdi-dev
mailing list