Class AllowedValueCollectingNodeItemVisitor
- All Implemented Interfaces:
INodeItemVisitor<DynamicContext,Void>
This visitor extends AbstractRecursionPreventingNodeItemVisitor to
safely handle recursive assembly definitions without infinite looping.
Usage example:
AllowedValueCollectingNodeItemVisitor visitor
= new AllowedValueCollectingNodeItemVisitor();
visitor.visit(module);
Collection<NodeItemRecord> locations = visitor.getAllowedValueLocations();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA record capturing the relationship between an allowed-values constraint, the definition where it is declared, and the target node it applies to.static final classA record that associates a definition node item with all the allowed-values constraints that target it. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected VoidThe initial, default visitation result, which will be used as the basis for aggregating results produced when visiting.Get the collected allowed-values constraint locations found during visitation.voidvisit(IModuleNodeItem module, DynamicContext context) Visit all definitions in the provided module node item using the given dynamic context.voidVisit all definitions in the provided module to collect allowed-values constraints.visitAssembly(IAssemblyInstanceGroupedNodeItem item, DynamicContext context) This callback is called when anIAssemblyInstanceGroupedNodeItemis visited.visitAssembly(IAssemblyNodeItem item, DynamicContext context) This callback is called when anIAssemblyNodeItemis visited.visitField(IFieldNodeItem item, DynamicContext context) This callback is called when anIFieldNodeItemis visited.visitFlag(IFlagNodeItem item, DynamicContext context) This callback is called when anIFlagNodeItemis visited.Methods inherited from class dev.metaschema.core.metapath.item.node.AbstractRecursionPreventingNodeItemVisitor
isDecendantMethods inherited from class dev.metaschema.core.metapath.item.node.AbstractNodeItemVisitor
aggregateResult, shouldVisitNextChild, shouldVisitNextChild, visit, visitDocument, visitFlags, visitMetaschema, visitModelChildren
-
Constructor Details
-
AllowedValueCollectingNodeItemVisitor
public AllowedValueCollectingNodeItemVisitor()
-
-
Method Details
-
getAllowedValueLocations
@NonNull public Collection<AllowedValueCollectingNodeItemVisitor.NodeItemRecord> getAllowedValueLocations()Get the collected allowed-values constraint locations found during visitation.- Returns:
- a collection of records, each containing a definition node item and the allowed-values constraints that target it
-
visit
Visit all definitions in the provided module to collect allowed-values constraints.This method creates a new
DynamicContextconfigured with the module's default namespace.- Parameters:
module- the Metaschema module to visit
-
visit
Visit all definitions in the provided module node item using the given dynamic context.The provided context is configured for module-definition walking: predicate evaluation is disabled and no-data atomization is treated as empty. These settings are applied regardless of their state on the incoming context so that expressions which reach instance-only functions (for example,
fn:docviaoscal:resolve-reference(@href)) degrade to empty sequences rather than raisingInvalidTypeFunctionExceptionand predicates on definitional targets do not attempt evaluation that requires instance data.- Parameters:
module- the module node item to visitcontext- the dynamic context to use for constraint evaluation
-
visitFlag
Description copied from interface:INodeItemVisitorThis callback is called when anIFlagNodeItemis visited.- Specified by:
visitFlagin interfaceINodeItemVisitor<DynamicContext,Void> - Overrides:
visitFlagin classAbstractNodeItemVisitor<DynamicContext,Void> - Parameters:
item- the visited itemcontext- provides contextual information for use by the visitor- Returns:
- the visitation result
-
visitField
Description copied from interface:INodeItemVisitorThis callback is called when anIFieldNodeItemis visited.- Specified by:
visitFieldin interfaceINodeItemVisitor<DynamicContext,Void> - Overrides:
visitFieldin classAbstractNodeItemVisitor<DynamicContext,Void> - Parameters:
item- the visited itemcontext- provides contextual information for use by the visitor- Returns:
- the visitation result
-
visitAssembly
Description copied from interface:INodeItemVisitorThis callback is called when anIAssemblyNodeItemis visited.- Specified by:
visitAssemblyin interfaceINodeItemVisitor<DynamicContext,Void> - Overrides:
visitAssemblyin classAbstractRecursionPreventingNodeItemVisitor<DynamicContext,Void> - Parameters:
item- the visited itemcontext- provides contextual information for use by the visitor- Returns:
- the visitation result
-
visitAssembly
Description copied from interface:INodeItemVisitorThis callback is called when anIAssemblyInstanceGroupedNodeItemis visited.- Specified by:
visitAssemblyin interfaceINodeItemVisitor<DynamicContext,Void> - Overrides:
visitAssemblyin classAbstractNodeItemVisitor<DynamicContext,Void> - Parameters:
item- the visited itemcontext- provides contextual information for use by the visitor- Returns:
- the visitation result
-
defaultResult
Description copied from class:AbstractNodeItemVisitorThe initial, default visitation result, which will be used as the basis for aggregating results produced when visiting.- Specified by:
defaultResultin classAbstractNodeItemVisitor<DynamicContext,Void> - Returns:
- the default result
- See Also:
-