You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Antonin Stefanutti (JIRA)" <ji...@apache.org> on 2015/12/15 19:59:46 UTC
[jira] [Comment Edited] (OWB-1099) Annotated SPI implementations do
not override equals and hashCode
[ https://issues.apache.org/jira/browse/OWB-1099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15058543#comment-15058543 ]
Antonin Stefanutti edited comment on OWB-1099 at 12/15/15 6:59 PM:
-------------------------------------------------------------------
[~struberg] Sorry for the late reply, I didn't get any notification.
The need arises when you customise an {{InjectionTarget}} or a {{Producer}} and you need to access the corresponding bean attributes like the qualifiers within them. At the moment you set the {{InjectionTarget}} (resp. the {{Producer}}) in the {{ProcessInjectionTarget}} (resp. in the {{ProcessProducer}}), the bean attributes are not accessible nor final as the {{ProcessBeanAttributes}} event is fired after.
So, the pattern I've seen and used in that use case is to store a mapping of Annotated to Bean.
Here is an example in the Camel CDI extension:
https://github.com/astefanutti/camel-cdi/blob/cc3f15f68513eabaa6c0312caa6bd469bd56e477/impl/src/main/java/org/apache/camel/cdi/CdiCamelExtension.java#L94
I'm convinced the use case make sense, though there may be a better pattern.
was (Author: antonin.stefanutti):
[~struberg] Sorry for the late reply, I didn't get any notification.
The need arises when you customise an {{InjectionTarget}} or a {{Producer}} and you need to access the corresponding bean attributes like the qualifiers within them. At the moment you set the {{InjectionTarget}} (resp. the {{Producer}}) in the {{ProcessInjectionTarget}} (resp. in the {{ProcessProducer}}), the bean attributes are not accessible nor final as the {{ProcessBeanAttributes}} event is fired after.
So, the pattern I've seen and used in that use case is to store a mapping of Annotated to Bean.
Here is an example in the Camel CDI extension:
https://github.com/astefanutti/camel-cdi/blob/cc3f15f68513eabaa6c0312caa6bd469bd56e477/impl/src/main/java/org/apache/camel/cdi/CdiCamelExtension.java#L94
I'm convince the use case make sense, though there may be a better pattern.
> Annotated SPI implementations do not override equals and hashCode
> -----------------------------------------------------------------
>
> Key: OWB-1099
> URL: https://issues.apache.org/jira/browse/OWB-1099
> Project: OpenWebBeans
> Issue Type: Bug
> Affects Versions: 1.6.2
> Reporter: Antonin Stefanutti
> Assignee: Mark Struberg
>
> The implementations of the {{Annotated}} SPIs do not override {{equals}} and {{hashCode}}.
> This prevents from looking up bean definitions by annotated elements which is often required when developing CDI extensions.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)