Class AutoWireStateManagerImpl
- java.lang.Object
-
- net.officefloor.compile.impl.state.autowire.AutoWireStateManagerImpl
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,Node
,AutoWireStateManager
public class AutoWireStateManagerImpl extends java.lang.Object implements AutoWireStateManager, Node
AutoWireStateManager
implementation.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description AutoWireStateManagerImpl(Office office, StateManager stateManager, OfficeNode officeNode, AutoWirer<LinkObjectNode> autoWirer, InternalSupplier[] internalSuppliers, MonitorClock monitorClock)
Instantiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Node[]
getChildNodes()
Obtains the childNode
instances.java.lang.String
getLocation()
Obtains the location of theNode
.java.lang.String
getNodeName()
Obtains the name of theNode
.java.lang.String
getNodeType()
Obtains theNode
type.<O> O
getObject(java.lang.String qualifier, java.lang.Class<? extends O> objectType, long timeoutInMilliseconds)
Obtains the object for theManagedObject
synchronously.Node
getParentNode()
boolean
isInitialised()
Indicates if theNode
has been initialised.boolean
isObjectAvailable(java.lang.String qualifier, java.lang.Class<?> objectType)
Indicates if the object by auto-wiring is available.<O> void
load(java.lang.String qualifier, java.lang.Class<? extends O> objectType, ObjectUser<O> user)
Loads the object from theManagedObject
asynchronously.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.officefloor.compile.internal.structure.Node
getQualifiedName, getQualifiedName
-
-
-
-
Constructor Detail
-
AutoWireStateManagerImpl
public AutoWireStateManagerImpl(Office office, StateManager stateManager, OfficeNode officeNode, AutoWirer<LinkObjectNode> autoWirer, InternalSupplier[] internalSuppliers, MonitorClock monitorClock)
Instantiate.- Parameters:
office
-Office
.stateManager
-StateManager
.officeNode
-OfficeNode
.autoWirer
-AutoWirer
.internalSuppliers
-InternalSupplier
instances.monitorClock
-MonitorClock
.
-
-
Method Detail
-
isObjectAvailable
public boolean isObjectAvailable(java.lang.String qualifier, java.lang.Class<?> objectType)
Description copied from interface:AutoWireStateManager
Indicates if the object by auto-wiring is available.- Specified by:
isObjectAvailable
in interfaceAutoWireStateManager
- Parameters:
qualifier
- Qualifier. May benull
.objectType
- Required object type.- Returns:
true
if the object is available.
-
load
public <O> void load(java.lang.String qualifier, java.lang.Class<? extends O> objectType, ObjectUser<O> user) throws UnknownObjectException
Description copied from interface:AutoWireStateManager
Loads the object from theManagedObject
asynchronously.- Specified by:
load
in interfaceAutoWireStateManager
- Parameters:
qualifier
- Qualifier. May benull
.objectType
- Required object type.user
-ObjectUser
to receive the loaded object (or possible failure).- Throws:
UnknownObjectException
- If unknown bound object name.
-
getObject
public <O> O getObject(java.lang.String qualifier, java.lang.Class<? extends O> objectType, long timeoutInMilliseconds) throws UnknownObjectException, java.lang.Throwable
Description copied from interface:AutoWireStateManager
Obtains the object for theManagedObject
synchronously.- Specified by:
getObject
in interfaceAutoWireStateManager
- Parameters:
qualifier
- Qualifier. May benull
.objectType
- Required object type.timeoutInMilliseconds
- Time out in milliseconds to wait for theManagedObject
creation.- Returns:
- Object.
- Throws:
UnknownObjectException
- If unknown bound object name.java.lang.Throwable
- If failure in obtaining the bound object.
-
close
public void close() throws java.lang.Exception
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.lang.Exception
-
getNodeName
public java.lang.String getNodeName()
Description copied from interface:Node
Obtains the name of theNode
.- Specified by:
getNodeName
in interfaceNode
- Returns:
- Name of the
Node
.
-
getNodeType
public java.lang.String getNodeType()
Description copied from interface:Node
Obtains theNode
type.- Specified by:
getNodeType
in interfaceNode
- Returns:
Node
type.
-
getLocation
public java.lang.String getLocation()
Description copied from interface:Node
Obtains the location of theNode
.- Specified by:
getLocation
in interfaceNode
- Returns:
- Location of the
Node
. May benull
ifNode
does not support a location.
-
getParentNode
public Node getParentNode()
Description copied from interface:Node
- Specified by:
getParentNode
in interfaceNode
- Returns:
Node
containing thisNode
.
-
isInitialised
public boolean isInitialised()
Description copied from interface:Node
Indicates if theNode
has been initialised.Node
instances should only be initialised once. Initialising theNode
twice is an issue.- Specified by:
isInitialised
in interfaceNode
- Returns:
true
if initialised.
-
-