continue;
}
if (found)
{
throw new WebBeansConfigurationException("@" + annot.getSimpleName()
+ " annotation is declared more than one method in the class : "
+ annotatedType.getJavaClass().getName());
}
found = true;
result = method.getJavaMember();
List<AnnotatedParameter<T>> parameters = method.getParameters();
List<Class<?>> clazzParameters = new ArrayList<Class<?>>();
for(AnnotatedParameter<T> parameter : parameters)
{
clazzParameters.add(ClassUtil.getClazz(parameter.getBaseType()));
}
Class<?>[] params = clazzParameters.toArray(new Class<?>[clazzParameters.size()]);
if (params.length != 1 || !params[0].equals(InvocationContext.class))
{
throw new WebBeansConfigurationException("@" + annot.getSimpleName() + " annotated method : "
+ method.getJavaMember().getName() + " in class : " + annotatedType.getJavaClass().getName()
+ " can not take any formal arguments other than InvocationContext");
}
if (!ClassUtil.getReturnType(method.getJavaMember()).equals(Object.class))
{
throw new WebBeansConfigurationException("@" + annot.getSimpleName() + " annotated method : "
+ method.getJavaMember().getName()+ " in class : " + annotatedType.getJavaClass().getName()
+ " must return Object type");
}
if (Modifier.isStatic(method.getJavaMember().getModifiers()) ||
ClassUtil.isFinal(method.getJavaMember().getModifiers()))
{
throw new WebBeansConfigurationException("@" + annot.getSimpleName() + " annotated method : "
+ method.getJavaMember().getName( )+ " in class : " + annotatedType.getJavaClass().getName()
+ " can not be static or final");
}
}
}