Module dev.metaschema.core
Class AbstractRecursionPreventingNodeItemVisitor<CONTEXT,RESULT>
java.lang.Object
dev.metaschema.core.metapath.item.node.AbstractNodeItemVisitor<CONTEXT,RESULT>
dev.metaschema.core.metapath.item.node.AbstractRecursionPreventingNodeItemVisitor<CONTEXT,RESULT>
- Type Parameters:
CONTEXT- the Java type of the visiting contextRESULT- the Java type of the visiting result
- All Implemented Interfaces:
INodeItemVisitor<CONTEXT,RESULT>
- Direct Known Subclasses:
RecursionCollectingNodeItemVisitor
public abstract class AbstractRecursionPreventingNodeItemVisitor<CONTEXT,RESULT>
extends AbstractNodeItemVisitor<CONTEXT,RESULT>
A node item visitor that prevents infinite recursion when traversing assembly
nodes by detecting and avoiding cycles in the node hierarchy.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanisDecendant(IAssemblyNodeItem node, IAssemblyDefinition assemblyDefinition) Determines if the provided node is a descendant of the assembly definition.visitAssembly(IAssemblyNodeItem item, CONTEXT context) This callback is called when anIAssemblyNodeItemis visited.Methods inherited from class dev.metaschema.core.metapath.item.node.AbstractNodeItemVisitor
aggregateResult, defaultResult, shouldVisitNextChild, shouldVisitNextChild, visit, visitAssembly, visitDocument, visitField, visitFlag, visitFlags, visitMetaschema, visitModelChildren
-
Constructor Details
-
AbstractRecursionPreventingNodeItemVisitor
public AbstractRecursionPreventingNodeItemVisitor()
-
-
Method Details
-
visitAssembly
Description copied from interface:INodeItemVisitorThis callback is called when anIAssemblyNodeItemis visited.- Specified by:
visitAssemblyin interfaceINodeItemVisitor<CONTEXT,RESULT> - Overrides:
visitAssemblyin classAbstractNodeItemVisitor<CONTEXT,RESULT> - Parameters:
item- the visited itemcontext- provides contextual information for use by the visitor- Returns:
- the visitation result
-
isDecendant
Determines if the provided node is a descendant of the assembly definition.- Parameters:
node- the node item to testassemblyDefinition- the assembly definition to determine as an ancestor of the node- Returns:
trueif the assembly definition is the node's ancestor, orfalseotherwise
-