rawType.equals(Interceptor.class))
{
Type[] types = ClassUtil.getActualTypeArguments(injectionPoint.getType());
if (types.length != 1 || !GenericsUtil.isAssignableFrom(false, AbstractProducerBean.class.isInstance(bean), bean.getBeanClass(), types[0]))
{
throw new DefinitionException("injected bean parameter must be " + rawType);
}
}
if (isDecorator)
{
List<Method> abstractMethods = ClassUtil.getAbstractMethods(bean.getBeanClass());
if (!abstractMethods.isEmpty())
{
Set<Type> types = ((javax.enterprise.inject.spi.Decorator) bean).getDecoratedTypes();
for (Method abstractMethod : abstractMethods)
{
boolean methodDeclared = false;
for (Type type : types)
{
if (ClassUtil.isMethodDeclared(ClassUtil.getClass(type), abstractMethod.getName(), abstractMethod.getParameterTypes()))
{
methodDeclared = true;
break;
}
}
if (!methodDeclared)
{
throw new DefinitionException("Decorator must not declare abstract methods which is not declared in any Decorated type.");
}
}
}
}
}
if (!injectionPoint.isDelegate())
{
webBeansContext.getBeanManagerImpl().validate(injectionPoint);
}
else
{
if (!isDecorator)
{
throw new WebBeansConfigurationException(
"Delegate injection points can not defined by beans that are not decorator. Injection point : "
+ injectionPoint);
}
else if (delegateFound)
{
throw new WebBeansConfigurationException(
"Only one Delegate injection point can be defined by decorator. Decorator : "
+ injectionPoint.getBean());
}
else
{
delegateFound = true;
}
}
if (injectionPoint.getQualifiers().contains(DefaultLiteral.INSTANCE)
&& ParameterizedType.class.isInstance(injectionPoint.getType())
&& javax.enterprise.inject.spi.Decorator.class == ParameterizedType.class.cast(injectionPoint.getType()).getRawType()
&& !isDecorator)
{
throw new DefinitionException("@Inject Decorator<X> only supported in decorators");
}
if (injectionPoint.getQualifiers().contains(DefaultLiteral.INSTANCE)
&& ParameterizedType.class.isInstance(injectionPoint.getType())
&& Interceptor.class == ParameterizedType.class.cast(injectionPoint.getType()).getRawType()
&& !isInterceptor)
{
throw new DefinitionException("@Inject Interceptor<X> only supported in interceptors");
}
}
}