/** Provisions a new T. */ private T provision(InternalContext context, ConstructionContext<T> constructionContext) throws InternalProvisionException { try { T t; try { Object[] parameters = SingleParameterInjector.getAll(context, parameterInjectors); t = constructionProxy.newInstance(parameters); constructionContext.setProxyDelegates(t); } finally { constructionContext.finishConstruction(); } // Store reference. If an injector re-enters this factory, they'll get the same reference. constructionContext.setCurrentReference(t); MembersInjectorImpl<T> localMembersInjector = membersInjector; localMembersInjector.injectMembers(t, context, false); localMembersInjector.notifyListeners(t); return t; } catch (InvocationTargetException userException) { Throwable cause = userException.getCause() != null ? userException.getCause() : userException; throw InternalProvisionException.errorInjectingConstructor(cause) .addSource(constructionProxy.getInjectionPoint()); } finally { constructionContext.removeCurrentReference(); } } }
void injectAndNotify(final T instance, final Errors errors, final boolean toolableOnly) throws ErrorsException { if (instance == null) { return; } injector.callInContext(new ContextualCallable<Void>() { public Void call(InternalContext context) throws ErrorsException { injectMembers(instance, errors, context, toolableOnly); return null; } }); // TODO: We *could* notify listeners too here, // but it's not clear if we want to. There's no way to know // if a MembersInjector from the usersMemberInjector list wants // toolable injections, so do we really want to notify // about injection? (We could take a strategy of only notifying // if atleast one InjectionPoint was toolable, in which case // the above callInContext could return 'true' if it injected // anything.) if(!toolableOnly) { notifyListeners(instance, errors); } }
void injectAndNotify(final T instance, final Errors errors, final boolean toolableOnly) throws ErrorsException { if (instance == null) { return; } injector.callInContext(new ContextualCallable<Void>() { public Void call(InternalContext context) throws ErrorsException { injectMembers(instance, errors, context, toolableOnly); return null; } }); // TODO: We *could* notify listeners too here, // but it's not clear if we want to. There's no way to know // if a MembersInjector from the usersMemberInjector list wants // toolable injections, so do we really want to notify // about injection? (We could take a strategy of only notifying // if atleast one InjectionPoint was toolable, in which case // the above callInContext could return 'true' if it injected // anything.) if(!toolableOnly) { notifyListeners(instance, errors); } }
void injectAndNotify(final T instance, final Errors errors, final boolean toolableOnly) throws ErrorsException { if (instance == null) { return; } injector.callInContext(new ContextualCallable<Void>() { public Void call(InternalContext context) throws ErrorsException { injectMembers(instance, errors, context, toolableOnly); return null; } }); // TODO: We *could* notify listeners too here, // but it's not clear if we want to. There's no way to know // if a MembersInjector from the usersMemberInjector list wants // toolable injections, so do we really want to notify // about injection? (We could take a strategy of only notifying // if atleast one InjectionPoint was toolable, in which case // the above callInContext could return 'true' if it injected // anything.) if(!toolableOnly) { notifyListeners(instance, errors); } }
notifyListeners(instance, errors);
/** Provisions a new T. */ private T provision(InternalContext context, ConstructionContext<T> constructionContext) throws InternalProvisionException { try { T t; try { Object[] parameters = SingleParameterInjector.getAll(context, parameterInjectors); t = constructionProxy.newInstance(parameters); constructionContext.setProxyDelegates(t); } finally { constructionContext.finishConstruction(); } // Store reference. If an injector re-enters this factory, they'll get the same reference. constructionContext.setCurrentReference(t); MembersInjectorImpl<T> localMembersInjector = membersInjector; localMembersInjector.injectMembers(t, context, false); localMembersInjector.notifyListeners(t); return t; } catch (InvocationTargetException userException) { Throwable cause = userException.getCause() != null ? userException.getCause() : userException; throw InternalProvisionException.errorInjectingConstructor(cause) .addSource(constructionProxy.getInjectionPoint()); } finally { constructionContext.removeCurrentReference(); } } }
/** Provisions a new T. */ private T provision(InternalContext context, ConstructionContext<T> constructionContext) throws InternalProvisionException { try { T t; try { Object[] parameters = SingleParameterInjector.getAll(context, parameterInjectors); t = constructionProxy.newInstance(parameters); constructionContext.setProxyDelegates(t); } finally { constructionContext.finishConstruction(); } // Store reference. If an injector re-enters this factory, they'll get the same reference. constructionContext.setCurrentReference(t); MembersInjectorImpl<T> localMembersInjector = membersInjector; localMembersInjector.injectMembers(t, context, false); localMembersInjector.notifyListeners(t); return t; } catch (InvocationTargetException userException) { Throwable cause = userException.getCause() != null ? userException.getCause() : userException; throw InternalProvisionException.errorInjectingConstructor(cause) .addSource(constructionProxy.getInjectionPoint()); } finally { constructionContext.removeCurrentReference(); } } }
membersInjector.notifyListeners(t, errors);
membersInjector.notifyListeners(t, errors);
membersInjector.notifyListeners(t, errors);
membersInjector.notifyListeners(t, errors);