private static <T> void addInjectPlan(ConstructionPlan<T> plan, final Field field, final Object injectedValue) { plan.add(new InitializationPlan<T>() { @Override public String getDescription() { return String.format("Injecting %s into field %s of class %s.", injectedValue, field.getName(), field.getDeclaringClass().getName()); } @Override public void initialize(T instance) { inject(instance, field, injectedValue); } }); }
@Override public T createObject() { T result = tracker.invoke(description, instanceConstructor); if (initializationPlans != null) { executeInitializationPLans(result); } return result; }
@Override public ObjectCreator<T> invoke() { validateConstructorForAutobuild(constructor); ObjectCreator[] constructorParameters = calculateParameters(locator, resources, constructor.getParameterTypes(), constructor.getGenericParameterTypes(), constructor.getParameterAnnotations(), tracker); Invokable<T> core = new ConstructorInvoker<T>(constructor, constructorParameters); Invokable<T> wrapped = logger == null ? core : new LoggingInvokableWrapper<T>(logger, description, core); ConstructionPlan<T> plan = new ConstructionPlan(tracker, description, wrapped); extendPlanForInjectedFields(plan, tracker, locator, resources, constructor.getDeclaringClass()); extendPlanForPostInjectionMethods(plan, tracker, locator, resources, constructor.getDeclaringClass()); return plan; } });
@Override public ObjectCreator<T> invoke() { validateConstructorForAutobuild(constructor); ObjectCreator[] constructorParameters = calculateParameters(locator, resources, constructor.getParameterTypes(), constructor.getGenericParameterTypes(), constructor.getParameterAnnotations(), tracker); Invokable<T> core = new ConstructorInvoker<T>(constructor, constructorParameters); Invokable<T> wrapped = logger == null ? core : new LoggingInvokableWrapper<T>(logger, description, core); ConstructionPlan<T> plan = new ConstructionPlan(tracker, description, wrapped); extendPlanForInjectedFields(plan, tracker, locator, resources, constructor.getDeclaringClass()); extendPlanForPostInjectionMethods(plan, tracker, locator, resources, constructor.getDeclaringClass()); return plan; } });
@Override public ObjectCreator<T> invoke() { ObjectCreator[] methodParameters = calculateParametersForMethod(method, locator, resources, tracker); Invokable<T> core = new MethodInvoker<T>(instance, method, methodParameters); Invokable<T> wrapped = logger == null ? core : new LoggingInvokableWrapper<T>(logger, description, core); return new ConstructionPlan(tracker, description, wrapped); } });
private static <T> void addInjectPlan(ConstructionPlan<T> plan, final Field field, final Object injectedValue) { plan.add(new InitializationPlan<T>() { @Override public String getDescription() { return String.format("Injecting %s into field %s of class %s.", injectedValue, field.getName(), field.getDeclaringClass().getName()); } @Override public void initialize(T instance) { inject(instance, field, injectedValue); } }); }
@Override public T createObject() { T result = tracker.invoke(description, instanceConstructor); if (initializationPlans != null) { executeInitializationPLans(result); } return result; }
@Override public ObjectCreator<T> invoke() { ObjectCreator[] methodParameters = calculateParametersForMethod(method, locator, resources, tracker); Invokable<T> core = new MethodInvoker<T>(instance, method, methodParameters); Invokable<T> wrapped = logger == null ? core : new LoggingInvokableWrapper<T>(logger, description, core); return new ConstructionPlan(tracker, description, wrapped); } });
resources, tracker); plan.add(new InitializationPlan<Object>()
resources, tracker); plan.add(new InitializationPlan<Object>()