Skip to content

Commit

Permalink
Injecting the generic configuration now requires the @Generic annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas authored and pmuir committed Oct 12, 2010
1 parent 8b3393e commit 1663d96
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
Expand Up @@ -308,12 +308,7 @@ public void redefine(RedefinitionContext<Inject> ctx)
{
if (ctx.getAnnotatedElement() instanceof Field)
{
if (ctx.getRawType().equals(genericConfigurationType))
{
// This is a Generic configuration injection point
ctx.getAnnotationBuilder().remove(Inject.class).add(InjectGenericLiteral.INSTANCE);
}
else if (ctx.getAnnotatedElement().isAnnotationPresent(Generic.class))
if (ctx.getAnnotatedElement().isAnnotationPresent(Generic.class))
{
// This is a Generic bean injection point
ctx.getAnnotationBuilder().remove(Inject.class).add(InjectGenericLiteral.INSTANCE);
Expand Down
Expand Up @@ -21,6 +21,7 @@
import javax.enterprise.inject.Produces;
import javax.inject.Inject;

import org.jboss.weld.extensions.bean.generic.Generic;
import org.jboss.weld.extensions.bean.generic.GenericConfiguration;

/**
Expand All @@ -37,6 +38,7 @@ public class Bar implements Serializable
private static final long serialVersionUID = -6679070875886826999L;

@Inject
@Generic
private Message injectedMessage;

// A Message with no @Inject
Expand Down
Expand Up @@ -24,8 +24,8 @@
import javax.inject.Inject;

import org.jboss.weld.extensions.bean.generic.ApplyScope;
import org.jboss.weld.extensions.bean.generic.GenericConfiguration;
import org.jboss.weld.extensions.bean.generic.Generic;
import org.jboss.weld.extensions.bean.generic.GenericConfiguration;
import org.jboss.weld.extensions.unwraps.Unwraps;

/**
Expand All @@ -51,6 +51,7 @@ public class Baz implements Serializable
private Corge corge;

@Inject
@Generic
private Message message;

public Bar getBar()
Expand Down
Expand Up @@ -19,6 +19,7 @@
import javax.enterprise.inject.Produces;
import javax.inject.Inject;

import org.jboss.weld.extensions.bean.generic.Generic;
import org.jboss.weld.extensions.bean.generic.GenericConfiguration;

/**
Expand All @@ -32,6 +33,7 @@
public class Bar
{
@Inject
@Generic
private Message injectedMessage;

// A Message with no @Inject
Expand Down
Expand Up @@ -18,8 +18,8 @@

import javax.inject.Inject;

import org.jboss.weld.extensions.bean.generic.GenericConfiguration;
import org.jboss.weld.extensions.bean.generic.Generic;
import org.jboss.weld.extensions.bean.generic.GenericConfiguration;

/**
* A generic bean for the config annotation Message
Expand All @@ -39,6 +39,7 @@ public class Baz
private Corge corge;

@Inject
@Generic
private Message message;

public Bar getBar()
Expand Down

0 comments on commit 1663d96

Please sign in to comment.