Skip to content

Commit

Permalink
WBRI-205
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@2184 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
pmuir committed Mar 24, 2009
1 parent edca34a commit 29b4195
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
Expand Up @@ -19,6 +19,7 @@

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Set;

import javax.context.CreationalContext;
Expand Down Expand Up @@ -129,6 +130,31 @@ else if (getAnnotatedItem().getAnnotatedParameters(Disposes.class).size() > 0)
{
throw new DefinitionException("Producer method cannot have parameter annotated @Disposes");
}
else if (declaringBean instanceof EnterpriseBean)
{
boolean methodDeclaredOnTypes = false;
// TODO use annotated item?
for (Type type : declaringBean.getTypes())
{
if (type instanceof Class)
{
Class<?> clazz = (Class<?>) type;
try
{
clazz.getDeclaredMethod(getAnnotatedItem().getName(), getAnnotatedItem().getParameterTypesAsArray());
methodDeclaredOnTypes = true;
}
catch (NoSuchMethodException nsme)
{
// No - op
}
}
}
if (!methodDeclaredOnTypes)
{
throw new DefinitionException("Producer method " + toString() + " must be declared on a business interface of " + declaringBean);
}
}
}

/**
Expand Down

0 comments on commit 29b4195

Please sign in to comment.