| Modifier and Type | Class and Description |
|---|---|
private static class |
SingletonContext.GenerationComparator |
| Modifier and Type | Field and Description |
|---|---|
private int |
generationNumber |
private ServiceLocatorImpl |
locator |
private Cache<ContextualInput<java.lang.Object>,java.lang.Object> |
valueCache |
| Constructor and Description |
|---|
SingletonContext(ServiceLocatorImpl impl) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(ActiveDescriptor<?> descriptor)
Determines if this context has a value for the given key
|
void |
destroyOne(ActiveDescriptor<?> one)
Release one system descriptor
|
<T> T |
findOrCreate(ActiveDescriptor<T> activeDescriptor,
ServiceHandle<?> root)
Creates a contextual instance of this ActiveDescriptor by calling its
create method if there is no other matching contextual instance.
|
java.lang.Class<? extends java.lang.annotation.Annotation> |
getScope()
The scope for which this is the context
|
boolean |
isActive()
True if this context is active, false otherwise
|
void |
shutdown()
Shut down this context.
|
boolean |
supportsNullCreation()
Returns true if the findOrCreate method can return null
|
private int generationNumber
private final ServiceLocatorImpl locator
private final Cache<ContextualInput<java.lang.Object>,java.lang.Object> valueCache
SingletonContext(ServiceLocatorImpl impl)
public java.lang.Class<? extends java.lang.annotation.Annotation> getScope()
Contextpublic <T> T findOrCreate(ActiveDescriptor<T> activeDescriptor, ServiceHandle<?> root)
ContextfindOrCreate in interface Context<javax.inject.Singleton>activeDescriptor - The descriptor to use when creating instancesroot - The extended provider for the outermost parent being createdpublic boolean containsKey(ActiveDescriptor<?> descriptor)
ContextcontainsKey in interface Context<javax.inject.Singleton>descriptor - The descriptor to look for in this contextpublic boolean isActive()
Contextpublic boolean supportsNullCreation()
ContextsupportsNullCreation in interface Context<javax.inject.Singleton>public void shutdown()
Contextpublic void destroyOne(ActiveDescriptor<?> one)
destroyOne in interface Context<javax.inject.Singleton>one - The descriptor to release (may not be null). Further, the cache MUST be set