Class NodeUtil
java.lang.Object
net.officefloor.compile.impl.structure.NodeUtil
Common utility functions for
Node implementations.- Author:
- Daniel Sagenschneider
-
Method Summary
Modifier and TypeMethodDescriptionstatic Node[]getChildNodes(Map<String, ? extends Node>... children) Obtains the childNodeinstances.static <N extends Node>
NgetInitialisedNode(String nodeName, Map<String, N> nodes, NodeContext context, Supplier<N> create, Consumer<N> initialiser) Obtains the initialisedNode.static <N extends Node>
NgetInitialisedNode(N existingNode, NodeContext context, Supplier<N> create, Consumer<N> initialiser) Obtains an initialisedNode.static StringgetLocation(String sourceClassName, Object sourceInstance, String location) Obtains the location for theNode.static <N extends Node>
NObtains the particularNode.static <S> Sinitialise(Node node, NodeContext context, S existingState, Supplier<S> createState) Initialises theNode.static booleanisNodeTreeInitialised(Node root, CompilerIssues issues) Indicates if theNodetree is fully initialised.static voidlogTreeStructure(Node node, Writer log)
-
Method Details
-
getNode
Obtains the particularNode. -
getInitialisedNode
public static <N extends Node> N getInitialisedNode(String nodeName, Map<String, N> nodes, NodeContext context, Supplier<N> create, Consumer<N> initialiser) Obtains the initialised
Node.Should the
Nodebe already initialised, an issue will be reported to theCompilerIssues. -
getInitialisedNode
public static <N extends Node> N getInitialisedNode(N existingNode, NodeContext context, Supplier<N> create, Consumer<N> initialiser) Obtains an initialisedNode. -
initialise
public static <S> S initialise(Node node, NodeContext context, S existingState, Supplier<S> createState) Initialises theNode.- Type Parameters:
S- Type of state.- Parameters:
node-Nodeto be initialised.context-NodeContext.existingState- Existing initialised state of theNode. May benull.createState-Supplierto create the initialised state.- Returns:
- Initialised state for the
Node.
-
isNodeTreeInitialised
Indicates if theNodetree is fully initialised.- Parameters:
root- RootNodeof tree.issues-CompilerIssues.- Returns:
trueif allNodeinstances within the tree are initialised.falseif non-initialisedNodeinstances within the tree, with issues reported to theCompilerIssues.
-
logTreeStructure
- Parameters:
node- RootNodeof tree.log-Writer.- Throws:
IOException- If fails to log.
-
getLocation
Obtains the location for theNode. -
getChildNodes
Obtains the childNodeinstances.
-