Interface IConstraintValidator

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
DefaultConstraintValidator

public interface IConstraintValidator extends AutoCloseable
This interface provides an entry point for performing validations over Metapath items associated with a Metaschema model.

Implementations may hold resources such as thread pools that must be released when validation is complete. Callers should use try-with-resources or explicitly call close() when done with the validator.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Release any resources held by this validator.
    void
    Complete any validations that require full analysis of the content model.
    void
    validate(INodeItem item, DynamicContext dynamicContext)
    Validate the provided item against any associated constraints.
  • Method Details

    • validate

      void validate(@NonNull INodeItem item, @NonNull DynamicContext dynamicContext) throws ConstraintValidationException
      Validate the provided item against any associated constraints.
      Parameters:
      item - the item to validate
      dynamicContext - the Metapath dynamic execution context to use for Metapath evaluation
      Throws:
      ConstraintValidationException - if a constraint violation is detected
      MetapathException - if an error occurred while evaluating a Metapath used in a constraint
    • finalizeValidation

      void finalizeValidation(@NonNull DynamicContext dynamicContext) throws ConstraintValidationException
      Complete any validations that require full analysis of the content model.
      Parameters:
      dynamicContext - the Metapath dynamic execution context to use for Metapath evaluation
      Throws:
      ConstraintValidationException - if a constraint violation is detected during finalization
      MetapathException - if an error occurred while evaluating a Metapath used in a constraint
    • close

      void close()
      Release any resources held by this validator.

      This method should be called when the validator is no longer needed to release resources such as thread pools. For validators using sequential execution, this method does nothing.

      Specified by:
      close in interface AutoCloseable