Class LinkUtil
- java.lang.Object
-
- net.officefloor.compile.impl.util.LinkUtil
-
public class LinkUtil extends java.lang.Object
Utility class to work with links.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends LinkFlowNode>
TfindFurtherestTarget(LinkFlowNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Finds the furtherest target link by the specified type.static <T extends LinkFlowNode>
TfindTarget(LinkFlowNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Finds the target link by the specified type.static <T extends Node>
TfindTarget(LinkPoolNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Finds the target by the specified type.static <T extends Node>
TfindTarget(LinkTeamNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Finds the target link by the specified type.static <T extends Node>
T[]findTargets(LinkStartAfterNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Finds the targets by the specified type.static <T extends Node>
T[]findTargets(LinkStartBeforeNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Finds the targets by the specified type.static boolean
linkAutoWireObjectNode(LinkObjectNode node, LinkObjectNode linkNode, OfficeNode office, AutoWirer<LinkObjectNode> autoWirer, CompileContext compileContext, CompilerIssues issues, java.util.function.Consumer<LinkObjectNode> loader)
Links theAutoWire
LinkObjectNode
.static boolean
linkAutoWireStartAfter(java.lang.Object managedObjectSource, java.lang.String managedObjectType, CompilerIssues issues, Node node)
Links theManagedObjectSourceNode
to start afterManagedObject
object type.static boolean
linkAutoWireStartBefore(java.lang.Object managedObjectSource, java.lang.String managedObjectType, CompilerIssues issues, Node node)
Links theManagedObjectSourceNode
to start beforeManagedObject
object type.static boolean
linkExecutionStrategy(java.lang.Object linkSource, java.lang.Object linkTarget, CompilerIssues issues, Node node)
Ensure both inputs are aLinkExecutionStrategyNode
and if so links them.static boolean
linkExecutionStrategyNode(LinkExecutionStrategyNode node, LinkExecutionStrategyNode linkNode, CompilerIssues issues, java.util.function.Consumer<LinkExecutionStrategyNode> loader)
Links theLinkExecutionStrategyNode
.static boolean
linkFlow(java.lang.Object linkSource, java.lang.Object linkTarget, CompilerIssues issues, Node node)
Ensures both inputs are aLinkFlowNode
and if so links them.static boolean
linkFlowNode(LinkFlowNode node, LinkFlowNode linkNode, CompilerIssues issues, java.util.function.Consumer<LinkFlowNode> loader)
Links theLinkFlowNode
.static boolean
linkManagedObjectSourceInput(java.lang.Object managedObjectSource, java.lang.Object inputManagedObject, CompilerIssues issues, Node node)
Links theManagedObjectSourceNode
to theInputManagedObjectNode
.static boolean
linkObject(java.lang.Object linkSource, java.lang.Object linkTarget, CompilerIssues issues, Node node)
Ensures both inputs are aLinkObjectNode
and if so links them.static boolean
linkObjectNode(LinkObjectNode node, LinkObjectNode linkNode, CompilerIssues issues, java.util.function.Consumer<LinkObjectNode> loader)
Links theLinkObjectNode
.static boolean
linkOffice(java.lang.Object linkSource, java.lang.Object linkTarget, CompilerIssues issues, Node node)
Ensures both inputs are aLinkOfficeNode
and if so links them.static boolean
linkOfficeNode(LinkOfficeNode node, LinkOfficeNode linkNode, CompilerIssues issues, java.util.function.Consumer<LinkOfficeNode> loader)
Links theLinkOfficeNode
.static boolean
linkPool(java.lang.Object linkSource, java.lang.Object linkTarget, CompilerIssues issues, Node node)
Ensures both inputs are aLinkPoolNode
and if so links them.static boolean
linkPoolNode(LinkPoolNode node, LinkPoolNode linkNode, CompilerIssues issues, java.util.function.Consumer<LinkPoolNode> loader)
Links theLinkPoolNode
.static boolean
linkStartAfter(java.lang.Object startLater, java.lang.Object startEarlier, CompilerIssues issues, Node node)
Links theManagedObjectSourceNode
to start after anotherManagedObjectSourceNode
.static boolean
linkStartBefore(java.lang.Object startEarlier, java.lang.Object startLater, CompilerIssues issues, Node node)
Links theManagedObjectSourceNode
to start before anotherManagedObjectSourceNode
.static boolean
linkTeam(java.lang.Object linkSource, java.lang.Object linkTarget, CompilerIssues issues, Node node)
Ensures both inputs are aLinkTeamNode
and if so links them.static boolean
linkTeamNode(LinkTeamNode node, LinkTeamNode linkNode, CompilerIssues issues, java.util.function.Consumer<LinkTeamNode> loader)
Links theLinkObjectNode
.static void
loadAllObjectAutoWires(LinkObjectNode node, java.util.Set<AutoWire> allAutoWires, CompileContext compileContext, CompilerIssues issues)
Loads theAutoWire
instances for theLinkObjectNode
along with its dependencyAutoWire
instances and subsequent (transitive) dependencyAutoWire
instances.static <T extends LinkObjectNode>
TretrieveFurtherestTarget(LinkObjectNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Finds the furtherest target link by the specified type.static <T extends Node>
TretrieveTarget(LinkExecutionStrategyNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Retrieves the target link by the specified type.static <T extends LinkFlowNode>
TretrieveTarget(LinkFlowNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Retrieves the target link by the specified type.static <T extends LinkObjectNode>
TretrieveTarget(LinkObjectNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Retrieves the target link by the specified type.static <T extends Node>
TretrieveTarget(LinkOfficeNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Retrieves the target link by the specified type.
-
-
-
Method Detail
-
linkFlow
public static boolean linkFlow(java.lang.Object linkSource, java.lang.Object linkTarget, CompilerIssues issues, Node node)
Ensures both inputs are aLinkFlowNode
and if so links them.- Parameters:
linkSource
- SourceLinkFlowNode
.linkTarget
- TargetLinkFlowNode
.issues
-CompilerIssues
.node
-Node
wishing to link theFlow
.- Returns:
true
if linked.
-
linkObject
public static boolean linkObject(java.lang.Object linkSource, java.lang.Object linkTarget, CompilerIssues issues, Node node)
Ensures both inputs are aLinkObjectNode
and if so links them.- Parameters:
linkSource
- SourceLinkObjectNode
.linkTarget
- TargetLinkObjectNode
.issues
-CompilerIssues
.node
-Node
wishing to link theFlow
.- Returns:
true
if linked.
-
linkTeam
public static boolean linkTeam(java.lang.Object linkSource, java.lang.Object linkTarget, CompilerIssues issues, Node node)
Ensures both inputs are aLinkTeamNode
and if so links them.- Parameters:
linkSource
- SourceLinkTeamNode
.linkTarget
- TargetLinkTeamNode
.issues
-CompilerIssues
.node
-Node
wishing to link theFlow
.- Returns:
true
if linked.
-
linkExecutionStrategy
public static boolean linkExecutionStrategy(java.lang.Object linkSource, java.lang.Object linkTarget, CompilerIssues issues, Node node)
Ensure both inputs are aLinkExecutionStrategyNode
and if so links them.- Parameters:
linkSource
- SourceLinkExecutionStrategyNode
.linkTarget
- TargetLinkExecutionStrategyNode
.issues
-CompilerIssues
.node
-Node
wishing to link theExecutionStrategy
.- Returns:
true
if linked.
-
linkOffice
public static boolean linkOffice(java.lang.Object linkSource, java.lang.Object linkTarget, CompilerIssues issues, Node node)
Ensures both inputs are aLinkOfficeNode
and if so links them.- Parameters:
linkSource
- SourceLinkOfficeNode
.linkTarget
- TargetLinkOfficeNode
.issues
-CompilerIssues
.node
-Node
wishing to link theFlow
.- Returns:
true
if linked.
-
linkPool
public static boolean linkPool(java.lang.Object linkSource, java.lang.Object linkTarget, CompilerIssues issues, Node node)
Ensures both inputs are aLinkPoolNode
and if so links them.- Parameters:
linkSource
- SourceLinkPoolNode
.linkTarget
- TargetLinkPoolNode
.issues
-CompilerIssues
.node
-Node
wishing to link theManagedObjectPool
.- Returns:
true
if linked.
-
linkManagedObjectSourceInput
public static boolean linkManagedObjectSourceInput(java.lang.Object managedObjectSource, java.lang.Object inputManagedObject, CompilerIssues issues, Node node)
Links theManagedObjectSourceNode
to theInputManagedObjectNode
.- Parameters:
managedObjectSource
-ManagedObjectSourceNode
.inputManagedObject
-InputManagedObjectNode
.issues
-CompilerIssues
.node
-Node
wishing to link theFlow
.- Returns:
true
if linked.
-
linkStartBefore
public static boolean linkStartBefore(java.lang.Object startEarlier, java.lang.Object startLater, CompilerIssues issues, Node node)
Links theManagedObjectSourceNode
to start before anotherManagedObjectSourceNode
.- Parameters:
startEarlier
-ManagedObjectSourceNode
to start earlier.startLater
-ManagedObjectSourceNode
to start later.issues
-CompilerIssues
.node
-Node
wishing to link the start before.- Returns:
true
if linked.
-
linkAutoWireStartBefore
public static boolean linkAutoWireStartBefore(java.lang.Object managedObjectSource, java.lang.String managedObjectType, CompilerIssues issues, Node node)
Links theManagedObjectSourceNode
to start beforeManagedObject
object type.- Parameters:
managedObjectSource
-ManagedObjectSourceNode
to start earlier.managedObjectType
-ManagedObject
object type to start later.issues
-CompilerIssues
.node
-Node
wishing to link the start before.- Returns:
true
if linked.
-
linkStartAfter
public static boolean linkStartAfter(java.lang.Object startLater, java.lang.Object startEarlier, CompilerIssues issues, Node node)
Links theManagedObjectSourceNode
to start after anotherManagedObjectSourceNode
.- Parameters:
startLater
-ManagedObjectSourceNode
to start later.startEarlier
-ManagedObjectSourceNode
to start earlier.issues
-CompilerIssues
.node
-Node
wishing to link the start before.- Returns:
true
if linked.
-
linkAutoWireStartAfter
public static boolean linkAutoWireStartAfter(java.lang.Object managedObjectSource, java.lang.String managedObjectType, CompilerIssues issues, Node node)
Links theManagedObjectSourceNode
to start afterManagedObject
object type.- Parameters:
managedObjectSource
-ManagedObjectSourceNode
to start later.managedObjectType
-ManagedObject
object type to start earlier.issues
-CompilerIssues
.node
-Node
wishing to link the start before.- Returns:
true
if linked.
-
findFurtherestTarget
public static <T extends LinkFlowNode> T findFurtherestTarget(LinkFlowNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Finds the furtherest target link by the specified type.- Type Parameters:
T
- Target type.- Parameters:
link
- StartingLinkFlowNode
.targetType
- TargetLinkFlowNode
type to find.issues
-CompilerIssues
.- Returns:
- Furtherest target
LinkFlowNode
ornull
if no targets found.
-
retrieveFurtherestTarget
public static <T extends LinkObjectNode> T retrieveFurtherestTarget(LinkObjectNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Finds the furtherest target link by the specified type.- Type Parameters:
T
- Target type.- Parameters:
link
- StartingLinkObjectNode
.targetType
- TargetLinkObjectNode
type to find.issues
-CompilerIssues
.- Returns:
- Furthurest target
LinkObjectNode
ornull
if no targets found.
-
findTarget
public static <T extends LinkFlowNode> T findTarget(LinkFlowNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Finds the target link by the specified type.- Type Parameters:
T
- Target type.- Parameters:
link
- StartingLinkFlowNode
.targetType
- TargetLinkFlowNode
type to find.issues
-CompilerIssues
.- Returns:
- Target
LinkFlowNode
ornull
if target not found.
-
retrieveTarget
public static <T extends LinkFlowNode> T retrieveTarget(LinkFlowNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Retrieves the target link by the specified type.- Type Parameters:
T
- Target type.- Parameters:
link
- StartingLinkFlowNode
.targetType
- TargetLinkFlowNode
type to retrieve.issues
-CompilerIssues
.- Returns:
- Target
LinkFlowNode
ornull
if issue obtaining which is reported to theCompilerIssues
.
-
retrieveTarget
public static <T extends LinkObjectNode> T retrieveTarget(LinkObjectNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Retrieves the target link by the specified type.- Type Parameters:
T
- Target type.- Parameters:
link
- StartingLinkObjectNode
.targetType
- TargetLinkObjectNode
type to retrieve.issues
-CompilerIssues
.- Returns:
- Target
LinkObjectNode
ornull
if issue obtaining which is reported to theCompilerIssues
.
-
findTarget
public static <T extends Node> T findTarget(LinkTeamNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Finds the target link by the specified type.- Type Parameters:
T
- Target type.- Parameters:
link
- StartingLinkTeamNode
.targetType
- TargetLinkTeamNode
type to retrieve.issues
-CompilerIssues
.- Returns:
- Target
LinkTeamNode
ornull
if not found.
-
retrieveTarget
public static <T extends Node> T retrieveTarget(LinkExecutionStrategyNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Retrieves the target link by the specified type.- Type Parameters:
T
- Target type.- Parameters:
link
- StartingLinkExecutionStrategyNode
.targetType
- TargetLinkExecutionStrategyNode
type to retrieve.issues
-CompilerIssues
.- Returns:
- Target
LinkExecutionStrategyNode
ornull
if issue obtaining which is reported to theCompilerIssues
.
-
retrieveTarget
public static <T extends Node> T retrieveTarget(LinkOfficeNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Retrieves the target link by the specified type.- Type Parameters:
T
- Target type.- Parameters:
link
- StartingLinkOfficeNode
.targetType
- TargetLinkOfficeNode
type to retrieve.issues
-CompilerIssues
.- Returns:
- Target
LinkOfficeNode
ornull
if issue obtaining which is reported to theCompilerIssues
.
-
findTarget
public static <T extends Node> T findTarget(LinkPoolNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Finds the target by the specified type.- Type Parameters:
T
- Target type.- Parameters:
link
- StartingLinkPoolNode
.targetType
- TargetLinkPoolNode
type to retrieve.issues
-CompilerIssues
.- Returns:
- Target
LinkPoolNode
ornull
if target not found.
-
findTargets
public static <T extends Node> T[] findTargets(LinkStartBeforeNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Finds the targets by the specified type.- Type Parameters:
T
- Target type.- Parameters:
link
- StartingLinkStartBeforeNode
.targetType
- TargetLinkStartBeforeNode
type to retrieve.issues
-CompilerIssues
.- Returns:
- Target
LinkStartBeforeNode
targets found.
-
findTargets
public static <T extends Node> T[] findTargets(LinkStartAfterNode link, java.lang.Class<T> targetType, CompilerIssues issues)
Finds the targets by the specified type.- Type Parameters:
T
- Target type.- Parameters:
link
- StartingLinkStartAfterNode
.targetType
- TargetLinkStartAfterNode
type to retrieve.issues
-CompilerIssues
.- Returns:
- Target
LinkStartAfterNode
targets found.
-
linkFlowNode
public static boolean linkFlowNode(LinkFlowNode node, LinkFlowNode linkNode, CompilerIssues issues, java.util.function.Consumer<LinkFlowNode> loader)
Links theLinkFlowNode
.- Parameters:
node
-LinkFlowNode
to have the link loaded.linkNode
- LinkLinkFlowNode
to load.issues
-CompilerIssues
.loader
-Consumer
to load the link onto theLinkFlowNode
.- Returns:
true
if successful, orfalse
with issue reported to theCompilerIssues
.
-
linkObjectNode
public static boolean linkObjectNode(LinkObjectNode node, LinkObjectNode linkNode, CompilerIssues issues, java.util.function.Consumer<LinkObjectNode> loader)
Links theLinkObjectNode
.- Parameters:
node
-LinkObjectNode
to have the link loaded.linkNode
- LinkLinkObjectNode
to load.issues
-CompilerIssues
.loader
-Consumer
to load the link onto theLinkObjectNode
.- Returns:
true
if successful, orfalse
with issue reported to theCompilerIssues
.
-
linkAutoWireObjectNode
public static boolean linkAutoWireObjectNode(LinkObjectNode node, LinkObjectNode linkNode, OfficeNode office, AutoWirer<LinkObjectNode> autoWirer, CompileContext compileContext, CompilerIssues issues, java.util.function.Consumer<LinkObjectNode> loader)
Links theAutoWire
LinkObjectNode
.- Parameters:
node
-LinkObjectNode
to have the link loaded.linkNode
- LinkLinkObjectNode
to load.office
-OfficeNode
.autoWirer
-AutoWirer
to enable dependencies to be auto-wired.compileContext
-CompileContext
.issues
-CompilerIssues
.loader
-Consumer
to load the link onto theLinkObjectNode
.- Returns:
true
if successful, orfalse
with issue reported to theCompilerIssues
.
-
loadAllObjectAutoWires
public static void loadAllObjectAutoWires(LinkObjectNode node, java.util.Set<AutoWire> allAutoWires, CompileContext compileContext, CompilerIssues issues)
Loads theAutoWire
instances for theLinkObjectNode
along with its dependencyAutoWire
instances and subsequent (transitive) dependencyAutoWire
instances.- Parameters:
node
-LinkObjectNode
to load transitive dependencyAutoWire
instances.allAutoWires
-Set
to be loaded with all theAutoWire
instances.compileContext
-CompileContext
issues
-CompilerIssues
.
-
linkTeamNode
public static boolean linkTeamNode(LinkTeamNode node, LinkTeamNode linkNode, CompilerIssues issues, java.util.function.Consumer<LinkTeamNode> loader)
Links theLinkObjectNode
.- Parameters:
node
-LinkTeamNode
to have the link loaded.linkNode
- LinkLinkTeamNode
to load.issues
-CompilerIssues
.loader
-Consumer
to load the link onto theLinkTeamNode
.- Returns:
true
if successful, orfalse
with issue reported to theCompilerIssues
.
-
linkExecutionStrategyNode
public static boolean linkExecutionStrategyNode(LinkExecutionStrategyNode node, LinkExecutionStrategyNode linkNode, CompilerIssues issues, java.util.function.Consumer<LinkExecutionStrategyNode> loader)
Links theLinkExecutionStrategyNode
.- Parameters:
node
-LinkExecutionStrategyNode
to have the link loaded.linkNode
-LinkExecutionStrategyNode
to load.issues
-CompilerIssues
.loader
-Consumer
to load the link onto theLinkExecutionStrategyNode
.- Returns:
true
if successful, orfalse
with issue reported to theCompilerIssues
.
-
linkOfficeNode
public static boolean linkOfficeNode(LinkOfficeNode node, LinkOfficeNode linkNode, CompilerIssues issues, java.util.function.Consumer<LinkOfficeNode> loader)
Links theLinkOfficeNode
.- Parameters:
node
-LinkOfficeNode
to have the link loaded.linkNode
- LinkLinkOfficeNode
to load.issues
-CompilerIssues
.loader
-Consumer
to load the link on theLinkOfficeNode
.- Returns:
true
if successful, orfalse
with issue reported to theCompilerIssues
.
-
linkPoolNode
public static boolean linkPoolNode(LinkPoolNode node, LinkPoolNode linkNode, CompilerIssues issues, java.util.function.Consumer<LinkPoolNode> loader)
Links theLinkPoolNode
.- Parameters:
node
-LinkPoolNode
to have the link loaded.linkNode
- LinkLinkPoolNode
to load.issues
-CompilerIssues
.loader
-Consumer
to load the link on theLinkPoolNode
.- Returns:
true
if successful, orfalse
with issue reported to theCompilerIssues
.
-
-