public class RequiredValidator extends Object implements Validator
A specialized Validator
implementation that checks
whether data was entered in mandatory fields.
This validator implementation can be assigned to mandatory input fields of
different types. When the form is validated it checks if the field contains
data. The isValid()
method is implemented in a generic way supporting
multiple data types. Thus this validator can collaborate with input fields of
different types. An object passed to the isValid()
method is
rejected in any of the following cases:
Iterable
interface, and the
iteration does not contain any elements
RequiredValidator
does not support any properties. The
following table lists the error messages that are generated by this validator
class:
Message key | Description | Parameters |
---|---|---|
|
This input field must contain a value. This is the error code which will be returned when the passed in object is rejected. | no parameters |
An instance of this class can be shared between multiple input components. If
additional validations are to be performed for a mandatory input field, a
ChainValidator
can be used that is initialized with a
RequiredValidator
and arbitrary other validator
implementations.
Constructor and Description |
---|
RequiredValidator() |
Modifier and Type | Method and Description |
---|---|
ValidationResult |
isValid(Object o,
TransformerContext ctx)
Validates the passed in object.
|
public ValidationResult isValid(Object o, TransformerContext ctx)
Copyright © 2016 The JGUIraffe Team. All rights reserved.