boolean definedInMethod,
List<InterceptorData> stack,
Method annotatedInterceptorClassMethod,
boolean defineWithInterceptorBinding)
{
InterceptorData intData = null;
Method method = null;
//Check for default constructor of EJB based interceptor
if(webBeansInterceptor == null)
{
if(definedInInterceptorClass)
{
Constructor<?> ct = ClassUtil.isContaintNoArgConstructor(interceptorClass);
if (ct == null)
{
throw new WebBeansConfigurationException("class : " + interceptorClass.getName()
+ " must have no-arg constructor");
}
}
}
if (interceptorType.equals(AroundInvoke.class) || interceptorType.equals(AroundTimeout.class))
{
method = WebBeansUtil.checkAroundInvokeAnnotationCriterias(interceptorClass, interceptorType);
}
else if (interceptorType.equals(PostConstruct.class))
{
if (definedInInterceptorClass)
{
method = WebBeansUtil.checkCommonAnnotationCriterias(interceptorClass, PostConstruct.class, true);
}
else
{
method = WebBeansUtil.checkCommonAnnotationCriterias(interceptorClass, PostConstruct.class, false);
}
}
else if (interceptorType.equals(PreDestroy.class))
{
if (definedInInterceptorClass)
{
method = WebBeansUtil.checkCommonAnnotationCriterias(interceptorClass, PreDestroy.class, true);
}
else
{
method = WebBeansUtil.checkCommonAnnotationCriterias(interceptorClass, PreDestroy.class, false);
}
}
if (method != null)
{
intData = new InterceptorDataImpl(defineWithInterceptorBinding);
intData.setDefinedInInterceptorClass(definedInInterceptorClass);
intData.setDefinedInMethod(definedInMethod);
intData.setInterceptorBindingMethod(annotatedInterceptorClassMethod);
intData.setWebBeansInterceptor(webBeansInterceptor);
if (definedInInterceptorClass)
{
intData.setInterceptorClass(interceptorClass);
}
intData.setInterceptorMethod(method, interceptorType);
stack.add(intData);
}
}