Class MetaConstraintSet

java.lang.Object
dev.metaschema.core.model.constraint.AbstractConstraintSet
dev.metaschema.core.model.constraint.MetaConstraintSet
All Implemented Interfaces:
IConstraintSet

public class MetaConstraintSet extends AbstractConstraintSet
A set of constraints, which are targeted at the contents of a Metaschema module within specific contexts.
  • Constructor Details

    • MetaConstraintSet

      public MetaConstraintSet(@NonNull ISource source, @NonNull List<? extends IConstraintSet> imports, @NonNull List<MetaConstraintSet.Context> contexts)
      Construct a new constraint set.
      Parameters:
      source - the source of the constraint set
      imports - other constraint sets imported by this set
      contexts - the contexts to use for this constraint set
  • Method Details

    • getImportedConstraintSets

      public Collection<? extends IConstraintSet> getImportedConstraintSets()
      Description copied from interface: IConstraintSet
      Get constraint sets imported by this constraint set.
      Returns:
      the imported constraint sets
    • applyConstraintsForModule

      public void applyConstraintsForModule(IModuleNodeItem moduleItem, IModelElementVisitor<ITargetedConstraints,Void> visitor)
      Description copied from interface: IConstraintSet
      Apply 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.

      Parameters:
      moduleItem - the module node item to apply applicable constraints to
      visitor - the visitor used to apply constraints to target definitions