Annotation[][] annots = this.observerMethod.getParameterAnnotations();
List<Object> list = new ArrayList<Object>();
Manager manager = ActivityManager.getInstance().getCurrentActivity();
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 CurrentLiteral();
}
else
{
for (Annotation observersAnnot : annot)
{
if (observersAnnot.annotationType().equals(Observes.class))
{
list.add(event);
observesAnnotation = true;
break;
}
}
}
if (!observesAnnotation)
{
Type[] args = new Type[0];
Class<?> clazz = null;
if (type instanceof ParameterizedType)
{
ParameterizedType pt = (ParameterizedType) type;
args = pt.getActualTypeArguments();
clazz = (Class<?>) pt.getRawType();
}
else
{
clazz = (Class<?>) type;
}
Annotation[] bindingTypes = AnnotationUtil.getBindingAnnotations(annot);
if (bindingTypes.length > 0)
{
list.add(manager.getInstance(InjectionResolver.getInstance().implResolveByType(clazz, args, bindingTypes).iterator().next()));
}
else
{
list.add(null);
}