[cdi-dev] Specializing producer methods & qualifiers
Christian Kaltepoth
christian at kaltepoth.de
Tue Apr 14 04:24:16 EDT 2015
Awesome! Thanks a lot!
Christian
2015-04-14 8:57 GMT+02:00 Jozef Hartinger <jharting at redhat.com>:
> Correct
>
>
> On 04/14/2015 08:55 AM, Christian Kaltepoth wrote:
>
> Hi Jozef,
>
> thanks a lot for your response. So if I read this correctly, the qualifier
> doesn't need to be annotated with @Inherited for this behavior. Is that
> correct?
>
> Christian
>
>
> 2015-04-14 8:26 GMT+02:00 Jozef Hartinger <jharting at redhat.com>:
>
>> Hi Christian,
>>
>> yes, the specializing producer inherits all the qualifiers of the
>> specialized producer. Furthermore, if the specialized producer had defined
>> a name, this would have been inherited as well (even without explicit
>> declaration on MyExtendedProducer.produce()). See
>> http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#direct_and_indirect_specialization
>> for details.
>>
>> Jozef
>>
>>
>> On 04/14/2015 06:13 AM, Christian Kaltepoth wrote:
>>
>> Hey all,
>>
>> I've a question regarding specializing qualified producer methods. It
>> would be great to get your opinion on this.
>>
>> Imaging this producer method:
>>
>> public class MyProducer {
>> @Produces
>> @MyQualifier
>> public Something produce() {
>> // ...
>> }
>> }
>>
>> Now imagine the producer method is specialized like this:
>>
>> public class MyExtendedProducer extends MyProducer {
>> @Override
>> @Produces
>> @Specializes
>> public Something produce() {
>> // ...
>> }
>> }
>>
>> Please not that I NOT added @MyQualifier to the specializing producer
>> method.
>>
>> Now for this injection point:
>>
>> @Inject
>> @MyQualifier
>> private Something something;
>>
>> What is expected to happen according to the spec? Will the specialized
>> producer be used or not?
>>
>> Thanks
>>
>> Christian
>>
>>
>> --
>> Christian Kaltepoth
>> Blog: http://blog.kaltepoth.de/
>> Twitter: http://twitter.com/chkal
>> GitHub: https://github.com/chkal
>>
>>
>>
>> _______________________________________________
>> cdi-dev mailing listcdi-dev at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/cdi-dev
>>
>> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
>>
>>
>>
>
>
> --
> Christian Kaltepoth
> Blog: http://blog.kaltepoth.de/
> Twitter: http://twitter.com/chkal
> GitHub: https://github.com/chkal
>
>
>
--
Christian Kaltepoth
Blog: http://blog.kaltepoth.de/
Twitter: http://twitter.com/chkal
GitHub: https://github.com/chkal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20150414/5774582a/attachment.html
More information about the cdi-dev
mailing list