EJB annotation = fields[i].getAnnotation(EJB.class);
lookupFieldResource(context, instance, fields[i],
annotation.name(), clazz);
}
if (fields[i].isAnnotationPresent(WebServiceRef.class)) {
WebServiceRef annotation =
fields[i].getAnnotation(WebServiceRef.class);
lookupFieldResource(context, instance, fields[i],
annotation.name(), clazz);
}
if (fields[i].isAnnotationPresent(PersistenceContext.class)) {
PersistenceContext annotation =
fields[i].getAnnotation(PersistenceContext.class);
lookupFieldResource(context, instance, fields[i],
annotation.name(), clazz);
}
if (fields[i].isAnnotationPresent(PersistenceUnit.class)) {
PersistenceUnit annotation =
fields[i].getAnnotation(PersistenceUnit.class);
lookupFieldResource(context, instance, fields[i],
annotation.name(), clazz);
}
}
// Initialize methods annotations
Method[] methods = null;
if (Globals.IS_SECURITY_ENABLED) {
final Class<?> clazz2 = clazz;
methods = AccessController.doPrivileged(
new PrivilegedAction<Method[]>(){
public Method[] run(){
return clazz2.getDeclaredMethods();
}
});
} else {
methods = clazz.getDeclaredMethods();
}
for (int i = 0; i < methods.length; i++) {
if (methods[i].isAnnotationPresent(Resource.class)) {
Resource annotation = methods[i].getAnnotation(Resource.class);
lookupMethodResource(context, instance, methods[i],
annotation.name(), clazz);
}
if (methods[i].isAnnotationPresent(EJB.class)) {
EJB annotation = methods[i].getAnnotation(EJB.class);
lookupMethodResource(context, instance, methods[i],
annotation.name(), clazz);
}
if (methods[i].isAnnotationPresent(WebServiceRef.class)) {
WebServiceRef annotation =
methods[i].getAnnotation(WebServiceRef.class);
lookupMethodResource(context, instance, methods[i],
annotation.name(), clazz);
}
if (methods[i].isAnnotationPresent(PersistenceContext.class)) {
PersistenceContext annotation =
methods[i].getAnnotation(PersistenceContext.class);
lookupMethodResource(context, instance, methods[i],
annotation.name(), clazz);
}
if (methods[i].isAnnotationPresent(PersistenceUnit.class)) {
PersistenceUnit annotation =
methods[i].getAnnotation(PersistenceUnit.class);
lookupMethodResource(context, instance, methods[i],
annotation.name(), clazz);
}
}
clazz = clazz.getSuperclass();
}