public class ProviderInstanceSatisfaction extends Object implements Satisfaction, Serializable
Satisfaction.makeInstantiator(Map, LifecycleManager)
is invoked.Constructor and Description |
---|
ProviderInstanceSatisfaction(javax.inject.Provider<?> provider)
Create a new satisfaction that wraps the given Provider instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
CachePolicy |
getDefaultCachePolicy()
Get the default cache policy for instances created by this satisfaction.
|
List<Desire> |
getDependencies()
Get this satisfaction's dependencies.
|
Class<?> |
getErasedType()
Get the type-erased class of this satisfaction's type.
|
javax.inject.Provider<?> |
getProvider() |
Type |
getType()
Get the type of this satisfaction.
|
int |
hashCode() |
boolean |
hasInstance()
Query whether this satisfaction already has an instance to return.
|
Instantiator |
makeInstantiator(Map<Desire,Instantiator> dependencies,
LifecycleManager lm)
Create an instantiator from this satisfaction.
|
String |
toString() |
<T> T |
visit(SatisfactionVisitor<T> visitor)
Visit the satisfaction.
|
public ProviderInstanceSatisfaction(javax.inject.Provider<?> provider)
provider
- The providerNullPointerException
- if provider is nullpublic CachePolicy getDefaultCachePolicy()
Satisfaction
Singleton
can be used to specify a default. BindingFunctions are
allowed to overrule the default cache policy.getDefaultCachePolicy
in interface Satisfaction
public javax.inject.Provider<?> getProvider()
Satisfaction.makeInstantiator(Map, LifecycleManager)
public List<Desire> getDependencies()
Satisfaction
getDependencies
in interface Satisfaction
public Type getType()
Satisfaction
getType
in interface Satisfaction
public Class<?> getErasedType()
Satisfaction
getErasedType
in interface Satisfaction
public boolean hasInstance()
Satisfaction
hasInstance
in interface Satisfaction
public <T> T visit(SatisfactionVisitor<T> visitor)
Satisfaction
visit
in interface Satisfaction
T
- The type returned from the visitor.visitor
- The visitor object.public Instantiator makeInstantiator(Map<Desire,Instantiator> dependencies, LifecycleManager lm)
Satisfaction
Create an instantiator from this satisfaction.
If the details of the Satisfaction require instantiation (e.g. a class or
provider class satisfaction), the returned provider should be a new
instance, and it should perform no memoization of its own. Caching is the
purview of Injector
implementations.
If the satisfaction is configured to use specific instances, this rule is obviously void.
makeInstantiator
in interface Satisfaction
dependencies
- A function mapping desires to providers of their
instances.lm
- The lifecycle manager (if one should be used).Copyright © 2016 GroupLens Research. All rights reserved.