Class ConfiguredByContext
java.lang.Object
org.glassfish.hk2.configuration.internal.ConfiguredByContext
- All Implemented Interfaces:
Context<ConfiguredBy>
@Singleton
@Visibility(LOCAL)
public class ConfiguredByContext
extends Object
implements Context<ConfiguredBy>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HashMap
<ActiveDescriptor<?>, Object> private final Object
private static final ThreadLocal
<ActiveDescriptor<?>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(ActiveDescriptor<?> descriptor) Determines if this context has a value for the given keyvoid
destroyOne
(ActiveDescriptor<?> descriptor) This method is called whenServiceHandle.destroy()
method is called.(package private) Object
findOnly
(ActiveDescriptor<?> descriptor) <U> U
findOrCreate
(ActiveDescriptor<U> 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 context(package private) ActiveDescriptor
<?> private <U> U
internalFindOrCreate
(ActiveDescriptor<U> activeDescriptor, ServiceHandle<?> root) boolean
isActive()
True if this context is active, false otherwisevoid
shutdown()
Shut down this context.boolean
Returns true if the findOrCreate method can return null
-
Field Details
-
workingOn
-
lock
-
db
-
-
Constructor Details
-
ConfiguredByContext
public ConfiguredByContext()
-
-
Method Details
-
getScope
Description copied from interface:Context
The scope for which this is the context- Specified by:
getScope
in interfaceContext<ConfiguredBy>
- Returns:
- may not return null, must return the scope for which this is a context
-
findOrCreate
Description copied from interface:Context
Creates 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:
findOrCreate
in interfaceContext<ConfiguredBy>
- 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
-
internalFindOrCreate
-
containsKey
Description copied from interface:Context
Determines if this context has a value for the given key- Specified by:
containsKey
in interfaceContext<ConfiguredBy>
- Parameters:
descriptor
- The descriptor to look for in this context- Returns:
- true if this context has a value associated with this descriptor
-
destroyOne
Description copied from interface:Context
This method is called whenServiceHandle.destroy()
method is called. It is up to the context implementation whether or not to honor this destruction request based on the lifecycle requirements of the context- Specified by:
destroyOne
in interfaceContext<ConfiguredBy>
- Parameters:
descriptor
- A non-null descriptor upon whichServiceHandle.destroy()
has been called
-
supportsNullCreation
public boolean supportsNullCreation()Description copied from interface:Context
Returns true if the findOrCreate method can return null- Specified by:
supportsNullCreation
in interfaceContext<ConfiguredBy>
- Returns:
- true if null is a legal value from the findOrCreate method
-
isActive
public boolean isActive()Description copied from interface:Context
True if this context is active, false otherwise- Specified by:
isActive
in interfaceContext<ConfiguredBy>
- Returns:
- true if this context is active, false otherwise
-
shutdown
public void shutdown()Description copied from interface:Context
Shut down this context.- Specified by:
shutdown
in interfaceContext<ConfiguredBy>
-
getWorkingOn
ActiveDescriptor<?> getWorkingOn() -
findOnly
-