Package com.google.inject.internal
Class FactoryProxy<T>
java.lang.Object
com.google.inject.internal.FactoryProxy<T>
- All Implemented Interfaces:
CreationListener
,InternalFactory<T>
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
FieldsModifier and TypeFieldDescriptionprivate final InjectorImpl
private final Object
private InternalFactory<? extends T>
-
Constructor Summary
ConstructorsConstructorDescriptionFactoryProxy
(InjectorImpl injector, Key<T> key, Key<? extends T> targetKey, Object source) -
Method Summary
Modifier and TypeMethodDescriptionget
(InternalContext context, Dependency<?> dependency, boolean linked) Creates an object to be injected.void
Notifies that creation should happen.toString()
-
Field Details
-
injector
-
key
-
targetKey
-
source
-
targetFactory
-
-
Constructor Details
-
FactoryProxy
-
-
Method Details
-
notify
Description copied from interface:CreationListener
Notifies that creation should happen.- Specified by:
notify
in interfaceCreationListener
-
get
public T get(InternalContext context, Dependency<?> dependency, boolean linked) throws InternalProvisionException Description copied from interface:InternalFactory
Creates an object to be injected.- Specified by:
get
in 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
-