@Override public BindingImpl<T> withKey(Key<T> key) { return new LinkedBindingImpl<>(getSource(), key, getScoping(), targetKey); }
@Override public void applyTo(Binder binder) { getScoping().applyTo(binder.withSource(getSource()).bind(getKey()).to(getLinkedKey())); }
@Override public BindingImpl<T> withScoping(Scoping scoping) { return new LinkedBindingImpl<>(getSource(), getKey(), scoping, targetKey); }
@Override public String toString() { return new ToStringBuilder(LinkedKeyBinding.class) .add("key", getKey()) .add("source", getSource()) .add("scope", getScoping()) .add("target", targetKey) .toString(); } }
@Override public Void visit(LinkedKeyBinding<? extends T> binding) { Key<? extends T> linkedKey = binding.getLinkedKey(); if (key.equals(linkedKey)) { errors.recursiveBinding(); } FactoryProxy<T> factory = new FactoryProxy<>(injector, key, linkedKey, source); creationListeners.add(factory); InternalFactory<? extends T> scopedFactory = Scopes.scope(key, injector, factory, scoping); putBinding( new LinkedBindingImpl<>(injector, key, source, scopedFactory, scoping, linkedKey)); return null; }
@Override public String toString() { return new ToStringBuilder(LinkedKeyBinding.class) .add("key", getKey()) .add("source", getSource()) .add("scope", getScoping()) .add("target", targetKey) .toString(); } }
@Override public BindingImpl<T> withScoping(Scoping scoping) { return new LinkedBindingImpl<>(getSource(), getKey(), scoping, targetKey); }
@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 void applyTo(Binder binder) { getScoping().applyTo(binder.withSource(getSource()).bind(getKey()).to(getLinkedKey())); }
@Override public String toString() { return new ToStringBuilder(LinkedKeyBinding.class) .add("key", getKey()) .add("source", getSource()) .add("scope", getScoping()) .add("target", targetKey) .toString(); } }
@Override public BindingImpl<T> withKey(Key<T> key) { return new LinkedBindingImpl<>(getSource(), key, getScoping(), targetKey); }
@Override public BindingImpl<T> withScoping(Scoping scoping) { return new LinkedBindingImpl<>(getSource(), getKey(), scoping, targetKey); }
return new LinkedBindingImpl<>( this, key,
@Override public void applyTo(Binder binder) { getScoping().applyTo(binder.withSource(getSource()).bind(getKey()).to(getLinkedKey())); }
@Override public String toString() { return new ToStringBuilder(LinkedKeyBinding.class) .add("key", getKey()) .add("source", getSource()) .add("scope", getScoping()) .add("target", targetKey) .toString(); } }
@Override public BindingImpl<T> withKey(Key<T> key) { return new LinkedBindingImpl<>(getSource(), key, getScoping(), targetKey); }
@Override public BindingImpl<T> withScoping(Scoping scoping) { return new LinkedBindingImpl<>(getSource(), getKey(), scoping, targetKey); }
@Override public Void visit(LinkedKeyBinding<? extends T> binding) { Key<? extends T> linkedKey = binding.getLinkedKey(); if (key.equals(linkedKey)) { errors.recursiveBinding(); } FactoryProxy<T> factory = new FactoryProxy<>(injector, key, linkedKey, source); creationListeners.add(factory); InternalFactory<? extends T> scopedFactory = Scopes.scope(key, injector, factory, scoping); putBinding( new LinkedBindingImpl<>(injector, key, source, scopedFactory, scoping, linkedKey)); return null; }
@Override public void applyTo(Binder binder) { getScoping().applyTo(binder.withSource(getSource()).bind(getKey()).to(getLinkedKey())); }
@Override public String toString() { return new ToStringBuilder(LinkedKeyBinding.class) .add("key", getKey()) .add("source", getSource()) .add("scope", getScoping()) .add("target", targetKey) .toString(); } }