@Override public T get(Errors errors, InternalContext context, Dependency<?> dependency) throws ErrorsException { return targetBinding.getInternalFactory().get( errors.withSource(targetKey), context, dependency); } };
private T inject(Errors errors, InternalContext context) throws ErrorsException { context.setDependency(dependency); try { return factory.get(errors.withSource(dependency), context, dependency); } finally { context.setDependency(null); } }
@Override public BindingBuilder<T> to(Key<? extends T> linkedKey) { Objects.requireNonNull(linkedKey, "linkedKey"); checkNotTargetted(); BindingImpl<T> base = getBinding(); setBinding(new LinkedBindingImpl<>( base.getSource(), base.getKey(), base.getScoping(), linkedKey)); return this; }
@Override public String toString() { return new ToStringBuilder(LinkedKeyBinding.class) .add("key", getKey()) .add("source", getSource()) .add("scope", getScoping()) .add("target", targetKey) .toString(); } }
@Override public String toString() { return new ToStringBuilder(ProviderKeyBinding.class) .add("key", getKey()) .add("source", getSource()) .add("scope", getScoping()) .add("provider", providerKey) .toString(); } }
@Override public String toString() { return new ToStringBuilder(ProviderInstanceBinding.class) .add("key", getKey()) .add("source", getSource()) .add("scope", getScoping()) .add("provider", providerInstance) .toString(); } }
public void asEagerSingleton() { checkNotScoped(); setBinding(getBinding().withScoping(Scoping.EAGER_SINGLETON)); }
@Override public Void call(InternalContext context) { context.setDependency(dependency); Errors errorsForBinding = errors.withSource(dependency); try { binding.getInternalFactory().get(errorsForBinding, context, dependency); } catch (ErrorsException e) { errorsForBinding.merge(e.getErrors()); } finally { context.setDependency(null); } return null; } });
@Override public String toString() { return new ToStringBuilder(PrivateElements.class) .add("exposedKeys", getExposedKeys()) .add("source", getSource()) .toString(); } }
@Override public synchronized void configure(Binder binder) { for (ProviderMethod<?> providerMethod : getProviderMethods(binder)) { providerMethod.configure(binder); } }
@Override public T get(Errors errors, InternalContext context, Dependency<?> dependency) throws ErrorsException { return targetFactory.get(errors.withSource(targetKey), context, dependency); }
@Override public T get(Errors errors, InternalContext context, Dependency<?> dependency) throws ErrorsException { return delegate.getInternalFactory().get(errors, context, dependency); } }
@Override public T call(InternalContext context) throws ErrorsException { Dependency dependency = context.getDependency(); return internalFactory.get(errors, context, dependency); } });
public void in(final Class<? extends Annotation> scopeAnnotation) { Objects.requireNonNull(scopeAnnotation, "scopeAnnotation"); checkNotScoped(); setBinding(getBinding().withScoping(Scoping.forAnnotation(scopeAnnotation))); }
public void in(final Scope scope) { Objects.requireNonNull(scope, "scope"); checkNotScoped(); setBinding(getBinding().withScoping(Scoping.forInstance(scope))); }