public static <X extends RemoteEnvironment> void processFieldAnnotations(InjectionContainer container, Collection<InjectionHandler<X>> handlers, Class<?> clazz, Map<AccessibleObject, Injector> classInjectors) { if (clazz == null || clazz.equals(Object.class)) { return; } if (handlers != null) { Field[] fields = clazz.getDeclaredFields(); for (Field field : fields) { log.trace("process field annotation for " + field.toGenericString()); for (InjectionHandler<?> handler : handlers) { handler.handleFieldAnnotations(field, container, classInjectors); } } } // recursion needs to come last as the method could be overriden and we don't want the overriding method to be ignored processFieldAnnotations(container, handlers, clazz.getSuperclass(), classInjectors); }
public static <X extends RemoteEnvironment> Map<AccessibleObject, Injector> processAnnotations(InjectionContainer container, Collection<InjectionHandler<X>> handlers, Class<?> clazz) { Map<AccessibleObject, Injector> classInjectors = new HashMap<AccessibleObject, Injector>(); HashSet<String> visitedMethods = new HashSet<String>(); collapseXmlMethodInjectors(visitedMethods, clazz, container.getEncInjections(), classInjectors); processClassAnnotations(container, handlers, clazz); visitedMethods = new HashSet<String>(); processMethodAnnotations(container, handlers, visitedMethods, clazz, classInjectors); processFieldAnnotations(container, handlers, clazz, classInjectors); return classInjectors; }