Take a look at http://download.oracle.com/javaee/6/api/javax/enterprise/inject/spi/InjectionPoint.html I think that should allow you to produce arbitrary instances

On Mon, May 23, 2011 at 15:05, Antoine Sabot-Durand <antoine@sabot-durand.net> wrote:
Hi Team,

To provide simple to powerfull ways to use Seam Social, I have 2 solutions to inject the same Bean

    @Inject
    Twitter twitter;

and
    @Inject
    @RelatedTo(Service.Twitter)
    OAuthService twitter; 

At the end "twitter" contains an instance of TwitterScribe bean in the 2 cases.

To achieve that I have to create a producer like this :

    @Produces
    @RelatedTo(Service.Twitter)
    protected OAuthService qualifiedTwitterProducer(@New TwitterScribe service) {
        return service;
    }

in addition of TwitterScribe bean which has the @Default qualifier.

As I'll have to do that for each service and people extending the API will also have to provide this straightforward producer for their own service bean, I was wondering if there wasn't a more elegant (generic ?) way to create a bean responding to @default and another qualifier the same way.

thanks for your feedback on that.


Antoine










_______________________________________________
seam-dev mailing list
seam-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/seam-dev




--
Jason Porter
http://lightguard-jp.blogspot.com
http://twitter.com/lightguardjp

Software Engineer
Open Source Advocate
Author of Seam Catch - Next Generation Java Exception Handling

PGP key id: 926CCFF5
PGP key available at: keyserver.net, pgp.mit.edu