Class ExcludedRule
java.lang.Object
org.pipservices3.commons.validate.ExcludedRule
- All Implemented Interfaces:
IValidationRule
Validation rule to check that value is excluded from the list of constants.
### Example ###
Schema schema = new Schema()
.withRule(new ExcludedRule(1, 2, 3));
schema.validate(2); // Result: 2 must not be one of 1, 2, 3
schema.validate(10); // Result: no errors
- See Also:
-
Constructor Summary
ConstructorDescriptionExcludedRule
(Object... values) Creates a new validation rule and sets its values. -
Method Summary
-
Constructor Details
-
ExcludedRule
Creates a new validation rule and sets its values.- Parameters:
values
- a list of constants that value must be excluded from
-
-
Method Details
-
validate
Validates the given value. None of the values set in this ExcludedRule object must exist in the value that is given for validation to pass.- Specified by:
validate
in interfaceIValidationRule
- Parameters:
path
- the dot notation path to the value that is to be validated.schema
- (not used in this implementation).value
- the value that is to be validated.results
- the results of the validation.
-