[
https://issues.jboss.org/browse/CDI-590?page=com.atlassian.jira.plugin.sy...
]
Matej Novotny commented on CDI-590:
-----------------------------------
I don't really like this idea. It feels 'hacky' and it could also contradict
the type-safe approach.
If I got it right, the idea is to have this producer:
{code}
@Produces
@MyProducerQualifier // this Qualifier has some annotation saying it is 'generic'
public Object create() {
// do some work and return Object
}
{code}
and then for this one producer to have the following injections:
{code}
@Inject
@MyProducerQualifier
String string;
@Inject
@MyProducerQualifier
Integer int;
{code}
Could you give a more specific use-case showing where this would make sense (or even
better, be neccessary)?
Provide a way to produce any type in a producer
-----------------------------------------------
Key: CDI-590
URL:
https://issues.jboss.org/browse/CDI-590
Project: CDI Specification Issues
Issue Type: Epic
Reporter: Romain Manni-Bucau
Note: this is a follow up "adding generic producers to CDI 2.0?" thread on the
list
It is common to rely on a subsystem (another IoC, a coercing system, ...) to produce
values. Today a producer can't say "I produce anything in a safe" manner.
Idea would be for injection point aware producers with a qualifier to producer Object and
match all types.
It needs another flag (can be in @Qualifier or another annotation it is not really
important) to say "I produce safely any type".
I did a PoC on github:
https://github.com/rmannibucau/generic-producer-cdi but think it
can be a nice feature of CDI 2.0 since it would avoid users to have to dig into extensions
for several simple cases (configuration, bridge to other IoC...)
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)