T inject(InternalContext context) throws InternalProvisionException { Dependency<T> localDependency = dependency; Dependency previous = context.pushDependency(localDependency, source); try { return factory.get(context, localDependency, false); } catch (InternalProvisionException ipe) { throw ipe.addSource(localDependency); } finally { context.popStateAndSetDependency(previous); } }
@Override public void inject(InternalContext context, Object o) throws InternalProvisionException { Dependency previous = context.pushDependency(dependency, binding.getSource()); try { Object value = binding.getInternalFactory().get(context, dependency, false); field.set(o, value); } catch (InternalProvisionException e) { throw e.addSource(dependency); } catch (IllegalAccessException e) { throw new AssertionError(e); // a security manager is blocking us, we're hosed } finally { context.popStateAndSetDependency(previous); } } }
@Override protected Optional<T> doProvision(InternalContext context, Dependency<?> currentDependency) throws InternalProvisionException { InternalFactory<? extends T> local = delegate; if (local == null) { return Optional.absent(); } Dependency<?> localDependency = targetDependency; T result; Dependency previous = context.pushDependency(localDependency, getSource()); try { // currentDependency is Optional<? super T>, so we really just need to set the target // dependency to ? super T, but we are currently setting it to T. We could hypothetically // make it easier for our delegate to generate proxies by modifying the dependency, but that // would also require us to rewrite the key on each call. So for now we don't do it. result = local.get(context, localDependency, false); } catch (InternalProvisionException ipe) { throw ipe.addSource(localDependency); } finally { context.popStateAndSetDependency(previous); } return Optional.fromNullable(result); }
@Override protected Object doProvision(InternalContext context, Dependency dependency) throws InternalProvisionException { InternalFactory<?> local = target; if (local == null) { return JAVA_OPTIONAL_EMPTY; } Dependency<?> localDependency = targetDependency; Object result; Dependency previous = context.pushDependency(localDependency, getSource()); try { // See comments in RealOptionalKeyProvider, about how localDependency may be more specific // than what we actually need. result = local.get(context, localDependency, false); } catch (InternalProvisionException ipe) { throw ipe.addSource(localDependency); } finally { context.popStateAndSetDependency(previous); } return invokeJavaOptionalOfNullable(result); }
@Override public T get() { InternalContext currentContext = enterContext(); Dependency previous = currentContext.pushDependency(dependency, source); try { T t = internalFactory.get(currentContext, dependency, false); return t; } catch (InternalProvisionException e) { throw e.addSource(dependency).toProvisionException(); } finally { currentContext.popStateAndSetDependency(previous); currentContext.close(); } }
if (isEagerSingleton(injector, binding, stage)) { Dependency<?> dependency = Dependency.get(binding.getKey()); Dependency previous = context.pushDependency(dependency, binding.getSource());
T inject(InternalContext context) throws InternalProvisionException { Dependency<T> localDependency = dependency; Dependency previous = context.pushDependency(localDependency, source); try { return factory.get(context, localDependency, false); } catch (InternalProvisionException ipe) { throw ipe.addSource(localDependency); } finally { context.popStateAndSetDependency(previous); } }
T inject(InternalContext context) throws InternalProvisionException { Dependency<T> localDependency = dependency; Dependency previous = context.pushDependency(localDependency, source); try { return factory.get(context, localDependency, false); } catch (InternalProvisionException ipe) { throw ipe.addSource(localDependency); } finally { context.popStateAndSetDependency(previous); } }
@Override public void inject(InternalContext context, Object o) throws InternalProvisionException { Dependency previous = context.pushDependency(dependency, binding.getSource()); try { Object value = binding.getInternalFactory().get(context, dependency, false); field.set(o, value); } catch (InternalProvisionException e) { throw e.addSource(dependency); } catch (IllegalAccessException e) { throw new AssertionError(e); // a security manager is blocking us, we're hosed } finally { context.popStateAndSetDependency(previous); } } }
@Override public void inject(InternalContext context, Object o) throws InternalProvisionException { Dependency previous = context.pushDependency(dependency, binding.getSource()); try { Object value = binding.getInternalFactory().get(context, dependency, false); field.set(o, value); } catch (InternalProvisionException e) { throw e.addSource(dependency); } catch (IllegalAccessException e) { throw new AssertionError(e); // a security manager is blocking us, we're hosed } finally { context.popStateAndSetDependency(previous); } } }
@Override protected Optional<T> doProvision(InternalContext context, Dependency<?> currentDependency) throws InternalProvisionException { InternalFactory<? extends T> local = delegate; if (local == null) { return Optional.absent(); } Dependency<?> localDependency = targetDependency; T result; Dependency previous = context.pushDependency(localDependency, getSource()); try { // currentDependency is Optional<? super T>, so we really just need to set the target // dependency to ? super T, but we are currently setting it to T. We could hypothetically // make it easier for our delegate to generate proxies by modifying the dependency, but that // would also require us to rewrite the key on each call. So for now we don't do it. result = local.get(context, localDependency, false); } catch (InternalProvisionException ipe) { throw ipe.addSource(localDependency); } finally { context.popStateAndSetDependency(previous); } return Optional.fromNullable(result); }
@Override protected Optional<T> doProvision(InternalContext context, Dependency<?> currentDependency) throws InternalProvisionException { InternalFactory<? extends T> local = delegate; if (local == null) { return Optional.absent(); } Dependency<?> localDependency = targetDependency; T result; Dependency previous = context.pushDependency(localDependency, getSource()); try { // currentDependency is Optional<? super T>, so we really just need to set the target // dependency to ? super T, but we are currently setting it to T. We could hypothetically // make it easier for our delegate to generate proxies by modifying the dependency, but that // would also require us to rewrite the key on each call. So for now we don't do it. result = local.get(context, localDependency, false); } catch (InternalProvisionException ipe) { throw ipe.addSource(localDependency); } finally { context.popStateAndSetDependency(previous); } return Optional.fromNullable(result); }
private T inject(Errors errors, InternalContext context) throws ErrorsException { Dependency previous = context.pushDependency(dependency, binding.getSource()); try { return binding.getInternalFactory().get(errors.withSource(dependency), context, dependency, false); } finally { context.popStateAndSetDependency(previous); } } }
@Override protected Object doProvision(InternalContext context, Dependency dependency) throws InternalProvisionException { InternalFactory<?> local = target; if (local == null) { return JAVA_OPTIONAL_EMPTY; } Dependency<?> localDependency = targetDependency; Object result; Dependency previous = context.pushDependency(localDependency, getSource()); try { // See comments in RealOptionalKeyProvider, about how localDependency may be more specific // than what we actually need. result = local.get(context, localDependency, false); } catch (InternalProvisionException ipe) { throw ipe.addSource(localDependency); } finally { context.popStateAndSetDependency(previous); } return invokeJavaOptionalOfNullable(result); }
@Override protected Object doProvision(InternalContext context, Dependency dependency) throws InternalProvisionException { InternalFactory<?> local = target; if (local == null) { return JAVA_OPTIONAL_EMPTY; } Dependency<?> localDependency = targetDependency; Object result; Dependency previous = context.pushDependency(localDependency, getSource()); try { // See comments in RealOptionalKeyProvider, about how localDependency may be more specific // than what we actually need. result = local.get(context, localDependency, false); } catch (InternalProvisionException ipe) { throw ipe.addSource(localDependency); } finally { context.popStateAndSetDependency(previous); } return invokeJavaOptionalOfNullable(result); }
public void inject(Errors errors, InternalContext context, Object o) { errors = errors.withSource(dependency); Dependency previous = context.pushDependency(dependency, binding.getSource()); try { Object value = binding.getInternalFactory().get(errors, context, dependency, false); field.set(o, value); } catch (ErrorsException e) { errors.withSource(injectionPoint).merge(e.getErrors()); } catch (IllegalAccessException e) { throw new AssertionError(e); // a security manager is blocking us, we're hosed } finally { context.popStateAndSetDependency(previous); } } }
@Override public T get() { InternalContext currentContext = enterContext(); Dependency previous = currentContext.pushDependency(dependency, source); try { T t = internalFactory.get(currentContext, dependency, false); return t; } catch (InternalProvisionException e) { throw e.addSource(dependency).toProvisionException(); } finally { currentContext.popStateAndSetDependency(previous); currentContext.close(); } }
@Override public T get() { InternalContext currentContext = enterContext(); Dependency previous = currentContext.pushDependency(dependency, source); try { T t = internalFactory.get(currentContext, dependency, false); return t; } catch (InternalProvisionException e) { throw e.addSource(dependency).toProvisionException(); } finally { currentContext.popStateAndSetDependency(previous); currentContext.close(); } }
if (isEagerSingleton(injector, binding, stage)) { Dependency<?> dependency = Dependency.get(binding.getKey()); Dependency previous = context.pushDependency(dependency, binding.getSource());
public Void call(InternalContext context) { Dependency previous = context.pushDependency(dependency, binding.getSource()); Errors errorsForBinding = errors.withSource(dependency); try { binding.getInternalFactory().get(errorsForBinding, context, dependency, false); } catch (ErrorsException e) { errorsForBinding.merge(e.getErrors()); } finally { context.popStateAndSetDependency(previous); } return null; } });