- java.lang.Object
-
- dagger.internal.InstanceFactory<T>
-
public final class InstanceFactory<T> extends java.lang.Object implements Factory<T>, Lazy<T>
AFactoryimplementation that returns a single instance for all invocations ofget().Note that while this is a
Factoryimplementation, and thus unscoped, each call toget()will always return the same instance. As such, any scoping applied to this factory is redundant and unnecessary. However, using this withDoubleCheck#provideris valid and may be desired for testing or contractual guarantees.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> Factory<T>create(T instance)static <T> Factory<T>createNullable(T instance)Tget()Return the underlying value, computing the value if necessary.
-