Package com.google.inject.internal
Class FactoryProxy<T>
- java.lang.Object
-
- com.google.inject.internal.FactoryProxy<T>
-
- All Implemented Interfaces:
CreationListener,InternalFactory<T>
final class FactoryProxy<T> extends java.lang.Object implements InternalFactory<T>, CreationListener
A placeholder which enables us to swap in the real factory once the injector is created. Used for a linked binding, so that getting the linked binding returns the link's factory.
-
-
Field Summary
Fields Modifier and Type Field Description private InjectorImplinjectorprivate Key<T>keyprivate java.lang.Objectsourceprivate InternalFactory<? extends T>targetFactoryprivate Key<? extends T>targetKey
-
Constructor Summary
Constructors Constructor Description FactoryProxy(InjectorImpl injector, Key<T> key, Key<? extends T> targetKey, java.lang.Object source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tget(InternalContext context, Dependency<?> dependency, boolean linked)Creates an object to be injected.voidnotify(Errors errors)Notifies that creation should happen.java.lang.StringtoString()
-
-
-
Field Detail
-
injector
private final InjectorImpl injector
-
source
private final java.lang.Object source
-
targetFactory
private InternalFactory<? extends T> targetFactory
-
-
Constructor Detail
-
FactoryProxy
FactoryProxy(InjectorImpl injector, Key<T> key, Key<? extends T> targetKey, java.lang.Object source)
-
-
Method Detail
-
notify
public void notify(Errors errors)
Description copied from interface:CreationListenerNotifies that creation should happen.- Specified by:
notifyin interfaceCreationListener
-
get
public T get(InternalContext context, Dependency<?> dependency, boolean linked) throws InternalProvisionException
Description copied from interface:InternalFactoryCreates an object to be injected.- Specified by:
getin interfaceInternalFactory<T>- Parameters:
context- of this injectionlinked- true if getting as a result of a linked binding- Returns:
- instance that was created
- Throws:
InternalProvisionException- if a value cannot be provided
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-