Class GenericValidator<S extends org.camunda.bpm.model.xml.instance.ModelElementInstance,T extends org.camunda.bpm.model.xml.instance.ModelElementInstance>
java.lang.Object
de.redsix.dmncheck.validators.core.GenericValidator<S,T>
- Type Parameters:
S
- Class used to check whether the validation is applicableT
- Class used for validation
- All Implemented Interfaces:
Validator
- Direct Known Subclasses:
AggregationOutputTypeValidator
,SimpleValidator
public abstract class GenericValidator<S extends org.camunda.bpm.model.xml.instance.ModelElementInstance,T extends org.camunda.bpm.model.xml.instance.ModelElementInstance>
extends Object
implements Validator
Generic validator that facilitates writing validations directly on the structure of the DMN model instance.
Note: We are using the Camunda implementation of the DMN model (...).
To write a validation using this validator you have to specify:
1) The element type (T) that is validated 2) The element type (S) that is used to check whether the validation is applicable
The validator collects all elements of type S and checks whether the validation is applicable. It then applies the validation on all child elements of type T.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionapply
(org.camunda.bpm.model.dmn.DmnModelInstance dmnModelInstance) Validates the given DMN model instance and returns the validation results as a list.Auxiliary method to determine the class for the validation.Auxiliary method to determine the class used for the applicability check.protected abstract boolean
isApplicable
(S element, ValidationContext validationContext) Checks whether the validation is applicable for an element of type S taking account of the validation context.protected abstract List<ValidationResult>
validate
(T element, ValidationContext validationContext) Validates a given element of type T.
-
Constructor Details
-
GenericValidator
public GenericValidator()
-
-
Method Details
-
isApplicable
Checks whether the validation is applicable for an element of type S taking account of the validation context.- Parameters:
element
- Element used to check applicability of the validationvalidationContext
- Validation Context- Returns:
- Whether the validation is applicable
-
validate
Validates a given element of type T.A validation context can be used to track global assumptions about the DMN model instance.
- Parameters:
element
- Element under validationvalidationContext
- Validation Context- Returns:
- A list of validation results
-
getClassUsedToCheckApplicability
Auxiliary method to determine the class used for the applicability check.- Returns:
- Class used to check whether the validation is applicable
-
getClassUnderValidation
Auxiliary method to determine the class for the validation.- Returns:
- Class used for validation
-
apply
Description copied from interface:Validator
Validates the given DMN model instance and returns the validation results as a list.
-