public class LongRangeValidator extends Object implements Validator, PartialStateHolder
LongRangeValidator is a
Validator
that checks the value of the corresponding
component against specified minimum and maximum values. The
following algorithm is implemented:
null
, exit immediately.ValidatorException
containing a
TYPE_MESSAGE_ID message.maximum
and minimum
property
has been configured on this Validator
, check the component
value against both limits. If the component value is not within
this specified range, throw a ValidatorException
containing a
NOT_IN_RANGE_MESSAGE_ID
message.maximum
property has been configured on this
Validator
, check the component value against
this limit. If the component value is greater than the
specified maximum, throw a ValidatorException
containing a
MAXIMUM_MESSAGE_ID message.minimum
property has been configured on this
Validator
, check the component value against
this limit. If the component value is less than the
specified minimum, throw a ValidatorException
containing a
MINIMUM_MESSAGE_ID message.For all of the above cases that cause a ValidatorException
to be thrown, if there are parameters to the message that match up
with validator parameters, the values of these parameters must be
converted using the Converter
registered in the application
under the converter id javax.faces.Number
. This allows
the values to be localized according to the current
Locale
.
Modifier and Type | Field and Description |
---|---|
static String |
MAXIMUM_MESSAGE_ID
The message identifier of the
FacesMessage to be created if
the maximum value check fails. |
static String |
MINIMUM_MESSAGE_ID
The message identifier of the
FacesMessage to be created if
the minimum value check fails. |
static String |
NOT_IN_RANGE_MESSAGE_ID
The message identifier of the
FacesMessage to be created if
the maximum or minimum value check fails, and both the maximum
and minimum values for this validator have been set. |
static String |
TYPE_MESSAGE_ID
The message identifier of the
FacesMessage to be created if
the current value of this component is not of the correct type. |
static String |
VALIDATOR_ID
The standard converter id for this converter.
|
Constructor and Description |
---|
LongRangeValidator()
Construct a
Validator with no preconfigured limits. |
LongRangeValidator(long maximum)
Construct a
Validator with the specified preconfigured
limit. |
LongRangeValidator(long maximum,
long minimum)
Construct a
Validator with the specified preconfigured
limits. |
Modifier and Type | Method and Description |
---|---|
void |
clearInitialState()
Reset the PartialStateHolder to a non-delta tracking state. |
boolean |
equals(Object otherObj) |
long |
getMaximum()
Return the maximum value to be enforced by this
Validator . |
long |
getMinimum()
Return the minimum value to be enforced by this
Validator . |
int |
hashCode() |
boolean |
initialStateMarked()
Return |
boolean |
isTransient()
If true, the Object implementing this interface must not
participate in state saving or restoring.
|
void |
markInitialState()
The runtime must ensure that the
|
void |
restoreState(FacesContext context,
Object state)
Perform any
processing required to restore the state from the entries in the
state Object.
|
Object |
saveState(FacesContext context)
Gets the state of the instance as a
Serializable Object. |
void |
setMaximum(long maximum)
Set the maximum value to be enforced by this
Validator . |
void |
setMinimum(long minimum)
Set the minimum value to be enforced by this
Validator . |
void |
setTransient(boolean transientValue)
Denotes
whether or not the Object implementing this interface must or
must not participate in state saving or restoring.
|
void |
validate(FacesContext context,
UIComponent component,
Object value)
|