Module dev.metaschema.core
Interface IConstraintValidator
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
DefaultConstraintValidator
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 TypeMethodDescriptionvoidclose()Release any resources held by this validator.voidfinalizeValidation(DynamicContext dynamicContext) Complete any validations that require full analysis of the content model.voidvalidate(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 validatedynamicContext- the Metapath dynamic execution context to use for Metapath evaluation- Throws:
ConstraintValidationException- if a constraint violation is detectedMetapathException- 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 finalizationMetapathException- 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:
closein interfaceAutoCloseable
-