@SuppressWarnings("unchecked")
protected List<ObserverParams> getMethodArguments(Object event)
{
WebBeansContext webBeansContext = bean.getWebBeansContext();
AnnotatedElementFactory annotatedElementFactory = webBeansContext.getAnnotatedElementFactory();
AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
//Define annotated parameter
AnnotatedType<T> annotatedType = (AnnotatedType<T>) annotatedElementFactory.newAnnotatedType(bean.getReturnType());
AnnotatedMethod<T> annotatedMethod = annotatedElementFactory.newAnnotatedMethod(observerMethod, annotatedType);
Type[] types = observerMethod.getGenericParameterTypes();
Annotation[][] annots = observerMethod.getParameterAnnotations();
List<ObserverParams> list = new ArrayList<ObserverParams>();
BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
ObserverParams param = null;
if (types.length > 0)
{
int i = 0;
for (Type type : types)
{
Annotation[] annot = annots[i];
boolean observesAnnotation = false;
if (annot.length == 0)
{
annot = new Annotation[1];
annot[0] = new DefaultLiteral();
}
else
{
for (Annotation observersAnnot : annot)
{
if (observersAnnot.annotationType().equals(Observes.class))
{
param = new ObserverParams();
param.instance = event;
list.add(param);
observesAnnotation = true;
break;
}
}
}
if (!observesAnnotation)
{
boolean injectionPointBeanLocalSetOnStack = false;
//Get parameter annotations
Annotation[] bindingTypes = annotationManager.getQualifierAnnotations(annot);
//Annotated parameter
AnnotatedParameter<T> annotatedParameter = annotatedMethod.getParameters().get(i);
//Creating injection point