public interface Satisfaction extends Serializable
Type
.
Satisfactions are expected to provide a reasonable implementation of
Object.equals(Object)
and Object.hashCode()
so that they can
be de-duplicated, etc.
Modifier and Type | Method and Description |
---|---|
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.
|
Type |
getType()
Get the type of this satisfaction.
|
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.
|
<T> T |
visit(SatisfactionVisitor<T> visitor)
Visit the satisfaction.
|
List<Desire> getDependencies()
Type getType()
Class<?> getErasedType()
boolean hasInstance()
<T> T visit(SatisfactionVisitor<T> visitor)
T
- The type returned from the visitor.visitor
- The visitor object.CachePolicy getDefaultCachePolicy()
Singleton
can be used to specify a default. BindingFunctions are
allowed to overrule the default cache policy.Instantiator makeInstantiator(@Nonnull Map<Desire,Instantiator> dependencies, @Nullable LifecycleManager lm)
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.
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.