|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.data.validator.CompositeValidator
public class CompositeValidator
The CompositeValidator allows you to chain (compose) many
validators to validate one field. The contained validators may be required to
all validate the value to validate or it may be enough that one contained
validator validates the value. This behaviour is controlled by the modes
AND and OR.
| Nested Class Summary | |
|---|---|
static class |
CompositeValidator.CombinationMode
|
| Nested classes/interfaces inherited from interface com.vaadin.data.Validator |
|---|
Validator.EmptyValueException, Validator.InvalidValueException |
| Field Summary | |
|---|---|
static CompositeValidator.CombinationMode |
MODE_AND
Deprecated. from 7.0, use CompositeValidator.CombinationMode.AND instead |
static CompositeValidator.CombinationMode |
MODE_OR
Deprecated. from 7.0, use CompositeValidator.CombinationMode.OR instead |
| Constructor Summary | |
|---|---|
CompositeValidator()
Construct a composite validator in AND mode without error
message. |
|
CompositeValidator(CompositeValidator.CombinationMode mode,
java.lang.String errorMessage)
Constructs a composite validator in given mode. |
|
| Method Summary | |
|---|---|
void |
addValidator(Validator validator)
Adds validator to the interface. |
java.lang.String |
getErrorMessage()
Gets the error message for the composite validator. |
CompositeValidator.CombinationMode |
getMode()
Gets the mode of the validator. |
java.util.Collection<Validator> |
getSubValidators(java.lang.Class validatorType)
Gets sub-validators by class. |
void |
removeValidator(Validator validator)
Removes a validator from the composite. |
void |
setErrorMessage(java.lang.String errorMessage)
Sets the message to be included in the exception in case the value does not validate. |
void |
setMode(CompositeValidator.CombinationMode mode)
Sets the mode of the validator. |
void |
validate(java.lang.Object value)
Validates the given value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@Deprecated public static final CompositeValidator.CombinationMode MODE_AND
CompositeValidator.CombinationMode.AND instead @Deprecated public static final CompositeValidator.CombinationMode MODE_OR
CompositeValidator.CombinationMode.OR instead | Constructor Detail |
|---|
public CompositeValidator()
AND mode without error
message.
public CompositeValidator(CompositeValidator.CombinationMode mode,
java.lang.String errorMessage)
mode - errorMessage - | Method Detail |
|---|
public void validate(java.lang.Object value)
throws Validator.InvalidValueException
The value is valid, if:
MODE_AND: All of the sub-validators are valid
MODE_OR: Any of the sub-validators are valid
validate in interface Validatorvalue - the value to check.
Validator.InvalidValueException - if the value is not valid.public final CompositeValidator.CombinationMode getMode()
CompositeValidator.CombinationMode.AND or
CompositeValidator.CombinationMode.OR.public void setMode(CompositeValidator.CombinationMode mode)
mode - the mode to set.public java.lang.String getErrorMessage()
public void addValidator(Validator validator)
validator - the Validator object which performs validation checks on this
set of data field values.public void removeValidator(Validator validator)
validator - the Validator object which performs validation checks on this
set of data field values.public java.util.Collection<Validator> getSubValidators(java.lang.Class validatorType)
If the component contains directly or recursively (it contains another
composite containing the validator) validators compatible with given type
they are returned. This only applies to AND mode composite
validators.
If the validator is in OR mode or does not contain any
validators of given type null is returned.
validatorType - The type of validators to return
public void setErrorMessage(java.lang.String errorMessage)
errorMessage - the error message.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||