Package dagger.internal
Class InstanceFactory<T>
- java.lang.Object
-
- dagger.internal.InstanceFactory<T>
-
public final class InstanceFactory<T> extends java.lang.Object implements Factory<T>, Lazy<T>
AFactory
implementation that returns a single instance for all invocations ofget()
.Note that while this is a
Factory
implementation, 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.provider
is 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)
T
get()
Return the underlying value, computing the value if necessary.
-