java.lang.Object
dev.metaschema.core.model.constraint.ScopedConstraintSet
- All Implemented Interfaces:
IConstraintSet
The default implementation of a constraint set sourced from an external
constraint resource.
-
Constructor Summary
ConstructorsConstructorDescriptionScopedConstraintSet(ISource source, List<IScopedContraints> scopedContraints, Set<IConstraintSet> importedConstraintSets) Construct a new constraint set. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyConstraintsForModule(IModuleNodeItem moduleItem, IModelElementVisitor<ITargetedConstraints, Void> visitor) Apply the constraints associated with this constraint set to the provided module, if applicable.Get constraint sets imported by this constraint set.Get the set of Metaschema scoped constraints to apply by aQNameformed from the Metaschema namespace and short name.Get the resource the constraint was provided from.
-
Constructor Details
-
ScopedConstraintSet
public ScopedConstraintSet(@NonNull ISource source, @NonNull List<IScopedContraints> scopedContraints, @NonNull Set<IConstraintSet> importedConstraintSets) Construct a new constraint set.- Parameters:
source- the resource the constraint was provided fromscopedContraints- a set of constraints qualified by a scope pathimportedConstraintSets- constraint sets imported by this constraint set
-
-
Method Details
-
getSource
Get the resource the constraint was provided from.- Specified by:
getSourcein interfaceIConstraintSet- Returns:
- the resource
-
getScopedContraints
Get the set of Metaschema scoped constraints to apply by aQNameformed from the Metaschema namespace and short name.- Returns:
- the mapping of QName to scoped constraints
-
getImportedConstraintSets
Description copied from interface:IConstraintSetGet constraint sets imported by this constraint set.- Specified by:
getImportedConstraintSetsin interfaceIConstraintSet- Returns:
- the imported constraint sets
-
applyConstraintsForModule
public void applyConstraintsForModule(IModuleNodeItem moduleItem, IModelElementVisitor<ITargetedConstraints, Void> visitor) Description copied from interface:IConstraintSetApply the constraints associated with this constraint set to the provided module, if applicable.Callers of this method are required to track which definitions have been previously targeted based on the result of this method and to provide these to subsequent calls of this method targeting different modules. This approach ensures that a given constraint is not applied more than once.
- Specified by:
applyConstraintsForModulein interfaceIConstraintSet- Parameters:
moduleItem- the module node item to apply applicable constraints tovisitor- the visitor used to apply constraints to target definitions
-