Class AbstractValidatorModelHandler<T extends Validator>
java.lang.Object
ch.tocco.nice2.validate.api.reader.handlers.validation.AbstractValidatorModelHandler<T>
- Direct Known Subclasses:
AllowedFileTypesModelHandler,DecimalDigitsModelHandler,GroupValidatorModelHandler,IbanModelHandler,LengthModelHandler,MandatoryModelHandler,NumberRangeModelHandler,RegexModelHandler,SocialSecurityNumberModelHandler
Base class for validation model readers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected ErrorLevelprotected Stringprotected booleanprotected final ValidatorReceiverprotected RunOnprotected T -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidWill be called after running thefinish()-Method.protected abstract voidWill be called before running thefinish()-Method.protected final TReturns an (instrumented) instance of the validator implementation.final voidfinish()Assembles the component together.A concrete class which implmentsAbstractValidatorModelHandler.Return the Interface which represents this validator.final voidsetContinue(Boolean doContinue) If the next validator shall continue if this one fails.final voidThe error level.final voidfinal voidIf the result shall be negated.final voidWhere to run the validator.
-
Field Details
-
validator
-
receiver
-
name
-
negate
protected boolean negate -
doContinue
protected boolean doContinue -
level
-
runOn
-
-
Constructor Details
-
AbstractValidatorModelHandler
-
-
Method Details
-
setName
-
setNegate
If the result shall be negated. This way a validator can be turned around: - "empty" → !empty - number range 5-10 → NOT 5-10 (including) - regex "foo" → must fail - ... -
setContinue
If the next validator shall continue if this one fails. -
setLevel
The error level.- Throws:
ModelBuildException
-
setRunOn
Where to run the validator.- Throws:
ModelBuildException
-
finish
Assembles the component together.- Throws:
ModelBuildException
-
createValidator
Returns an (instrumented) instance of the validator implementation. -
getImplClass
A concrete class which implmentsAbstractValidatorModelHandler. Expects a public-constructor which takes the Validatable.- Returns:
- the class
-
getInterface
Return the Interface which represents this validator. This interface is normallyAbstractValidatorModelHandler- Returns:
- interface-class
-
beforeFinish
Will be called before running thefinish()-Method. It is a good place for validating properties read from xml since all is read at this point.- Throws:
ModelBuildException
-
afterFinish
Will be called after running thefinish()-Method. Thevalidatorobject is ready now, so it's the place to assign validator-specific properties read from xml to it.- Throws:
ModelBuildException
-