Class GroupValidatorModelHandler<T extends GroupValidator>
java.lang.Object
ch.tocco.nice2.validate.api.reader.handlers.validation.AbstractValidatorModelHandler<T>
ch.tocco.nice2.validate.api.reader.handlers.validation.GroupValidatorModelHandler<T>
- All Implemented Interfaces:
ValidatorReceivable
- Direct Known Subclasses:
AndGroupValidatorModelHandler
public abstract class GroupValidatorModelHandler<T extends GroupValidator>
extends AbstractValidatorModelHandler<T>
implements ValidatorReceivable
Handles the validations tag with children as well as the group tag.
Technically it's the same, but visually and from inheritance it makes sense to name them differently. Otherwise we'd either have to name them both "validations-group", or stick a first "group" tag into the "validations" tag.
-
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class ch.tocco.nice2.validate.api.reader.handlers.validation.AbstractValidatorModelHandler
doContinue, level, name, negate, receiver, runOn, validator -
Constructor Summary
ConstructorsConstructorDescriptionGroupValidatorModelHandler(ValidatorReceiver receiver, ValidatorHandlerContextFactory validatorHandlerContextFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddValidator(Validator validator) Adds a validator implementation that was built based on the xml of a child of this group.protected voidWill be called before running theAbstractValidatorModelHandler.finish()-Method.Handles any validator element like regex, number-range etc.Methods inherited from class ch.tocco.nice2.validate.api.reader.handlers.validation.AbstractValidatorModelHandler
afterFinish, createValidator, finish, getImplClass, getInterface, setContinue, setLevel, setName, setNegate, setRunOn
-
Field Details
-
fieldValidators
-
-
Constructor Details
-
GroupValidatorModelHandler
public GroupValidatorModelHandler(ValidatorReceiver receiver, ValidatorHandlerContextFactory validatorHandlerContextFactory)
-
-
Method Details
-
addValidator
Adds a validator implementation that was built based on the xml of a child of this group.- Specified by:
addValidatorin interfaceValidatorReceivable- Parameters:
validator- The validator.- Throws:
IllegalArgumentException- if a later validator uses a stronger error level than a previous one in the same group.
-
tag
@AnyElement @Cardinality(min=0, max=2147483647) public Object tag(@ElementName String tagName) throws ModelBuildException Handles any validator element like regex, number-range etc.- Throws:
ModelBuildException
-
beforeFinish
Description copied from class:AbstractValidatorModelHandlerWill be called before running theAbstractValidatorModelHandler.finish()-Method. It is a good place for validating properties read from xml since all is read at this point.- Specified by:
beforeFinishin classAbstractValidatorModelHandler<T extends GroupValidator>- Throws:
ModelBuildException
-