Class ManagedObjectContainerImpl
- java.lang.Object
-
- net.officefloor.frame.impl.execute.managedobject.ManagedObjectContainerImpl
-
- All Implemented Interfaces:
Asset
,ManagedObjectContainer
public class ManagedObjectContainerImpl extends java.lang.Object implements ManagedObjectContainer, Asset
Container of aManagedObject
.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description ManagedObjectContainerImpl(ManagedObject managedObject, ManagedObjectMetaData<D> metaData, ThreadState responsibleThreadState)
Initiate the container with a providedManagedObject
.ManagedObjectContainerImpl(ManagedObjectMetaData<D> metaData, ThreadState responsibleThreadState)
Initiate the container.
-
Method Summary
-
-
-
Constructor Detail
-
ManagedObjectContainerImpl
public ManagedObjectContainerImpl(ManagedObjectMetaData<D> metaData, ThreadState responsibleThreadState)
Initiate the container.- Type Parameters:
D
- Dependency key type.- Parameters:
metaData
- Meta-data of theManagedObject
.responsibleThreadState
-ThreadState
responsible for making changes to thisManagedObjectContainer
.
-
ManagedObjectContainerImpl
public ManagedObjectContainerImpl(ManagedObject managedObject, ManagedObjectMetaData<D> metaData, ThreadState responsibleThreadState)
Initiate the container with a providedManagedObject
.- Type Parameters:
D
- Dependency key type.- Parameters:
managedObject
-ManagedObject
triggering theProcessState
.metaData
-ManagedObjectMetaData
of theManagedObject
.responsibleThreadState
-ThreadState
responsible for making changes to thisManagedObjectContainer
.
-
-
Method Detail
-
getManagedObjectContainer
public static ManagedObjectContainer getManagedObjectContainer(ManagedObjectIndex index, ManagedFunctionContainer managedFunction)
Convenience method to obtain theManagedObjectContainer
.- Parameters:
index
-ManagedObjectIndex
to identify theManagedObjectContainer
.managedFunction
-ManagedFunctionContainer
to specify context for obtaining theManagedObjectContainer
.- Returns:
ManagedObjectContainer
.
-
getResponsibleThreadState
public ThreadState getResponsibleThreadState()
Description copied from interface:ManagedObjectContainer
Obtains theThreadState
responsible for changes to thisManagedObjectContainer
.- Specified by:
getResponsibleThreadState
in interfaceManagedObjectContainer
- Returns:
ThreadState
responsible for changes to thisManagedObjectContainer
.
-
loadManagedObject
public FunctionState loadManagedObject(ManagedFunctionContainer managedFunction)
Description copied from interface:ManagedObjectContainer
Creates aFunctionState
to load theManagedObject
.- Specified by:
loadManagedObject
in interfaceManagedObjectContainer
- Parameters:
managedFunction
-ManagedFunctionContainer
requiring theManagedObject
.- Returns:
- Optional
FunctionState
to load theManagedObject
. Should this returnnull
, theManagedFunctionContainer
should not then be executed, as it is expecting to wait. This will return theManagedFunctionContainer
when theManagedObject
is loaded.
-
checkReady
public FunctionState checkReady(ManagedObjectReadyCheck check)
Description copied from interface:ManagedObjectContainer
Creates a
FunctionState
to check if theManagedObject
contained within thisManagedObjectContainer
is ready.Should the
ManagedObject
not be ready, then will latch to wait for theManagedObject
to be ready.- Specified by:
checkReady
in interfaceManagedObjectContainer
- Parameters:
check
-ManagedObjectReadyCheck
.- Returns:
FunctionState
to check if theManagedObject
contained within thisManagedObjectContainer
is ready.
-
getObject
public java.lang.Object getObject()
Description copied from interface:ManagedObjectContainer
Obtains the object being managed by theManagedObject
.- Specified by:
getObject
in interfaceManagedObjectContainer
- Returns:
- Object being managed by the
ManagedObject
.
-
getOptionalObject
public java.lang.Object getOptionalObject()
Description copied from interface:ManagedObjectContainer
Obtains the object only if available, otherwisenull
.- Specified by:
getOptionalObject
in interfaceManagedObjectContainer
- Returns:
- Object being managed by the
ManagedObject
ornull
if not yet available. - See Also:
OptionalThreadLocal
-
extractExtension
public <E> FunctionState extractExtension(ManagedObjectExtensionExtractor<E> extractor, E[] managedObjectExtensions, int extensionIndex, TeamManagement responsibleTeam)
Description copied from interface:ManagedObjectContainer
Extracts the
ManagedObject
extension from theManagedObject
contained in thisManagedObjectContainer
.Should the
ManagedObject
not be loaded, then noManagedObject
extension will be loaded.- Specified by:
extractExtension
in interfaceManagedObjectContainer
- Type Parameters:
E
- Extension type.- Parameters:
extractor
-ManagedObjectExtensionExtractor
.managedObjectExtensions
-List
to load theManagedObject
extension.extensionIndex
- Index within theManagedObject
extensions array to load the extension.responsibleTeam
-TeamManagement
responsible for extracting the extension. May benull
to use anyTeam
.- Returns:
FunctionState
to load theManagedObject
extension.
-
unregisterGovernance
public FunctionState unregisterGovernance(int governanceIndex)
Description copied from interface:ManagedObjectContainer
Unregisters theManagedObject
fromGovernance
.- Specified by:
unregisterGovernance
in interfaceManagedObjectContainer
- Parameters:
governanceIndex
- Index of theGovernance
.- Returns:
FunctionState
to unregister theManagedObject
fromGovernance
.
-
unloadManagedObject
public FunctionState unloadManagedObject()
Description copied from interface:ManagedObjectContainer
Creates aFunctionState
to unload theManagedObject
.- Specified by:
unloadManagedObject
in interfaceManagedObjectContainer
- Returns:
FunctionState
to unload theManagedObject
.
-
getOwningThreadState
public ThreadState getOwningThreadState()
Description copied from interface:Asset
Obtains theThreadState
owning thisAsset
.- Specified by:
getOwningThreadState
in interfaceAsset
- Returns:
ThreadState
owning thisAsset
.
-
checkOnAsset
public void checkOnAsset(CheckAssetContext context)
Description copied from interface:Asset
Checks on theAsset
.- Specified by:
checkOnAsset
in interfaceAsset
- Parameters:
context
-CheckAssetContext
for checking on theAsset
.
-
-