Interface GroupValidator
- All Known Subinterfaces:
AndGroupValidator
- All Known Implementing Classes:
AbstractGroupValidator, AndGroupValidatorImpl, GroupValidatorView
-
Nested Class Summary
Nested classes/interfaces inherited from interface Validator
Validator.MergeMode -
Method Summary
Modifier and TypeMethodDescriptionvoidaddValidator(Validator validator) Adds a validator to the group.voidaddValidator(Validator validator, boolean respectLevelOrder) Adds a validator to the group in the right position.@Nullable ValidatorFinds a child validator, either a direct child or somewhere down the hierarchy, with the given name path.Returns a list with the validators in this group.booleanbooleanmergeInValidatorByType(Validator validator, Validator.MergeMode mode) Tells an existing validator of that type (with same level and no conditions) to merge in the attributes of the given one, or adds the passed validator if no such is here yet.voidremoveValidator(Validator validator) Remove a validator to the group.Methods inherited from interface Iterable
forEach, iterator, spliteratorMethods inherited from interface Validator
canMergeConstraints, clone, doContinueOnFailure, doNegate, getLevel, getName, getRunOn, getType, hasName, mergeConstraints, setContinue, setLevel, setName, setNegate, setRunOn, validate
-
Method Details
-
hasValidators
boolean hasValidators()- Returns:
- Tells if this group has any validators.
-
getValidators
-
findChild
Finds a child validator, either a direct child or somewhere down the hierarchy, with the given name path.If you are looking for a direct child then specify the name, eg "myLengthValidator".
If you're looking for one down in a group then use the path, eg "myAndGroup.myLengthConditionalGroup.myLengthValidator". -
addValidator
Adds a validator to the group.- Parameters:
validator- validator, non-null- Throws:
IllegalStateException- If validator is there already.
-
removeValidator
Remove a validator to the group.- Parameters:
validator- validator, non-null- Throws:
IllegalStateException- If validator cannot be found.
-
addValidator
Adds a validator to the group in the right position.Validators of error level ERROR need to come before WARN need to come before INFO. The xml model reader makes sure the validators are given in the right order. But once manual customization, as well as merging comes in, this is required.
- Throws:
IllegalStateException- If validator is there already.
-
mergeInValidatorByType
Tells an existing validator of that type (with same level and no conditions) to merge in the attributes of the given one, or adds the passed validator if no such is here yet.- Parameters:
validator- The validator to merge in.mode- .- Returns:
- true if it was merged, false if it was added
-