Class SingletonContext
java.lang.Object
org.jvnet.hk2.internal.SingletonContext
- All Implemented Interfaces:
Context<javax.inject.Singleton>
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate final ServiceLocatorImplprivate final Cache<ContextualInput<Object>, Object> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(ActiveDescriptor<?> descriptor) Determines if this context has a value for the given keyvoiddestroyOne(ActiveDescriptor<?> one) Release one system descriptor<T> TfindOrCreate(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.Class<? extends Annotation> getScope()The scope for which this is the contextbooleanisActive()True if this context is active, false otherwisevoidshutdown()Shut down this context.booleanReturns true if the findOrCreate method can return null
-
Field Details
-
generationNumber
private int generationNumber -
locator
-
valueCache
-
-
Constructor Details
-
SingletonContext
SingletonContext(ServiceLocatorImpl impl)
-
-
Method Details
-
getScope
Description copied from interface:ContextThe scope for which this is the context -
findOrCreate
Description copied from interface:ContextCreates a contextual instance of this ActiveDescriptor by calling its create method if there is no other matching contextual instance. If there is already a contextual instance it is returned. If parent is null then this must work like the find call- Specified by:
findOrCreatein interfaceContext<javax.inject.Singleton>- Parameters:
activeDescriptor- The descriptor to use when creating instancesroot- The extended provider for the outermost parent being created- Returns:
- A context instance. This value may NOT be null
-
containsKey
Description copied from interface:ContextDetermines if this context has a value for the given key- Specified by:
containsKeyin interfaceContext<javax.inject.Singleton>- Parameters:
descriptor- The descriptor to look for in this context- Returns:
- true if this context has a value associated with this descriptor
-
isActive
-
supportsNullCreation
public boolean supportsNullCreation()Description copied from interface:ContextReturns true if the findOrCreate method can return null- Specified by:
supportsNullCreationin interfaceContext<javax.inject.Singleton>- Returns:
- true if null is a legal value from the findOrCreate method
-
shutdown
-
destroyOne
Release one system descriptor- Specified by:
destroyOnein interfaceContext<javax.inject.Singleton>- Parameters:
one- The descriptor to release (may not be null). Further, the cache MUST be set
-