Class AbstractValidatorModelHandler<T extends Validator>
java.lang.Object
ch.tocco.nice2.validate.api.reader.handlers.validation.AbstractValidatorModelHandler<T>
- Direct Known Subclasses:
DecimalDigitsModelHandler
,GroupValidatorModelHandler
,IbanModelHandler
,LengthModelHandler
,MandatoryModelHandler
,NumberRangeModelHandler
,RegexModelHandler
,SocialSecurityNumberModelHandler
Base class for validation model readers.
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected ErrorLevel
protected String
protected boolean
protected final ValidatorReceiver
protected RunOn
protected T
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
Will be called after running thefinish()
-Method.protected abstract void
Will be called before running thefinish()
-Method.protected final T
Returns an (instrumented) instance of the validator implementation.final void
finish()
Assembles the component together.A concrete class which implmentsAbstractValidatorModelHandler
.Return the Interface which represents this validator.final void
setContinue
(Boolean doContinue) If the next validator shall continue if this one fails.final void
The error level.final void
final void
If the result shall be negated.final void
Where 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. Thevalidator
object is ready now, so it's the place to assign validator-specific properties read from xml to it.- Throws:
ModelBuildException
-