public boolean needRequestScoped(Class defaultType) throws IllegalAccessException { Set<Field> fields = new HashSet<>(); fields.addAll(getInheritedPrivateFields(defaultType)); for (Field field : fields) { for (InjectIntrospector c : requestScopedIntrospectors) { if (c.supportedType(field.getType())) { return true; } } } return false; }
/** * @param instance the requested object. * @param defaultType the type of the requested object * @param framework the {@link org.atmosphere.runtime.AtmosphereFramework} * @param <U> * @throws IllegalAccessException */ public <U> void injectInjectable(U instance, Class<? extends U> defaultType, AtmosphereFramework framework) throws IllegalAccessException { Set<Field> fields = getInheritedPrivateFields(defaultType); injectFields(fields, instance, framework, injectables); }
public void requestScoped(Object instance, Class defaultType) throws IllegalAccessException { Set<Field> fields = new HashSet<>(); fields.addAll(getInheritedPrivateFields(defaultType)); for (Field field : fields) { for (InjectIntrospector c : requestScopedIntrospectors) { for (Class annotation : c.getClass().getAnnotation(RequestScoped.class).value()) { if (field.isAnnotationPresent(annotation)) { c.introspectField(instance.getClass(), field); if (c.supportedType(field.getType())) { try { field.setAccessible(true); field.set(instance, c.injectable(config)); } finally { field.setAccessible(false); } break; } } } } } }
while (t.hasNext()) { instance = t.next(); fields.addAll(getInheritedPrivateFields(instance.getClass())); try { injectFields(fields, instance, framework, injectables);
public void requestScoped(Object instance, Class defaultType, AtmosphereResource r) throws IllegalAccessException { Set<Field> fields = new HashSet<>(); fields.addAll(getInheritedPrivateFields(defaultType)); for (Field field : fields) { for (InjectIntrospector c : requestScopedIntrospectors) { for (Class annotation : c.getClass().getAnnotation(RequestScoped.class).value()) { if (field.isAnnotationPresent(annotation)) { c.introspectField(instance.getClass(), field); if (c.supportedType(field.getType())) { try { field.setAccessible(true); field.set(instance, c.injectable(r)); } finally { field.setAccessible(false); } break; } } } } } }