Class WStackedValidator
- java.lang.Object
-
- eu.webtoolkit.jwt.WValidator
-
- eu.webtoolkit.jwt.WStackedValidator
-
public class WStackedValidator extends WValidator
A validator that combines multiple validators.This validator allows you to combine multiple validators into a single one.
For a value to be considered valid by this validator, it must be valid for all of the validators added to it. In case the value is invalid for multiple validators, the validator used to generate the error message is the one with the lowest index.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WValidator
WValidator.Result
-
-
Constructor Summary
Constructors Constructor Description WStackedValidator()Creates an empty stacked validator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddValidator(WValidator validator)Adds a validator.voidclear()Removes all the validators.java.lang.StringgetJavaScriptValidate()Creates a Javascript object that validates the input.intgetSize()Returns the number of validators.voidinsertValidator(int index, WValidator validator)Inserts a validator to the given index.voidremoveValidator(WValidator validator)Removes the given validator.WValidator.Resultvalidate(java.lang.String input)Validates the given input.-
Methods inherited from class eu.webtoolkit.jwt.WValidator
getFormat, getInputFilter, getInvalidBlankText, isMandatory, setInvalidBlankText, setMandatory
-
-
-
-
Method Detail
-
addValidator
public void addValidator(WValidator validator)
Adds a validator.This adds a validator at the last index if the validator is not already present in the list of validators.
-
insertValidator
public void insertValidator(int index, WValidator validator)Inserts a validator to the given index.This inserts a validator at the given index, or at last index if the given index is bigger than the number of validators. Does nothing if the validator is already present in the list of validators.
-
removeValidator
public void removeValidator(WValidator validator)
Removes the given validator.
-
getSize
public int getSize()
Returns the number of validators.
-
clear
public void clear()
Removes all the validators.
-
validate
public WValidator.Result validate(java.lang.String input)
Description copied from class:WValidatorValidates the given input.Note: The signature for this method changed in JWt 3.2.0.
- Overrides:
validatein classWValidator
-
getJavaScriptValidate
public java.lang.String getJavaScriptValidate()
Description copied from class:WValidatorCreates a Javascript object that validates the input.The JavaScript expression should evaluate to an object which contains a
validate(text)function, which returns an object that contains the following two fields:- fields: a boolean valid,
- a
messagethat indicates the problem if not valid.
Returns an empty string if the validator does not provide a client-side validation implementationq.
- Overrides:
getJavaScriptValidatein classWValidator- See Also:
WValidator.getInputFilter()
-
-