DoubleRangeValidator 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 jakarta.faces.Number. This allows
the values to be localized according to the current Locale.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private Double | |
| public static final String | MAXIMUM_MESSAGE_ID
The message identifier of the |
| private Double | |
| public static final String | MINIMUM_MESSAGE_ID
The message identifier of the |
| public static final String | NOT_IN_RANGE_MESSAGE_ID
The message identifier of the |
| private boolean | |
| public static final String | TYPE_MESSAGE_ID
The message identifier of the |
| public static final String | VALIDATOR_ID
The standard converter id for this converter. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | DoubleRangeValidator(double
Maximum value to allow maximum)
Construct a |
| public | DoubleRangeValidator(double
Maximum value to allow maximum, double Minimum value to allow minimum)
Construct a |
| Modifier and Type | Method and Description |
|---|---|
| public void | clearInitialState()
Implements jakarta. Reset the PartialStateHolder to a non-delta tracking state. |
| private static double | doubleValue(Object
The attribute value to be converted attributeValue)
Return the specified attribute value, converted to a |
| public boolean | Returns: true if equal, false otherwise.the object to compare against. otherObj)Overrides java. Overrides the default equals method to take the minimum and maximum into account when comparing DoubleRangeValidator instances. |
| public double | Returns: the maximum
Return the maximum value to be enforced by this |
| public double | Returns: the minimum value
Return the minimum value to be enforced by this |
| public int | Returns: the hash code.Overrides java. Overrides the default hash code method to take the minimum and maximum into account when generating the hash code. |
| public boolean | initialStateMarked()
Implements jakarta.
Return |
| private boolean | |
| private boolean | |
| public boolean | isTransient()
Implements jakarta. If true, the Object implementing this interface must not participate in state saving or restoring. |
| public void | markInitialState()
Implements jakarta.
The runtime must ensure that the |
| public void | restoreState(FacesContext
the Faces context. context, Object the state. state)Implements jakarta. Perform any processing required to restore the state from the entries in the state Object. |
| public Object | saveState(FacesContext
the Faces context. context)Implements jakarta.
Gets the state of the instance as a |
| public void | setMaximum(double
The new maximum value maximum)
Set the maximum value to be enforced by this |
| public void | setMinimum(double
The new minimum value minimum)
Set the minimum value to be enforced by this |
| public void | setTransient(boolean
boolean pass transientValue)true if this Object will
not participate in state saving or restoring, otherwise pass false.Implements jakarta. Denotes whether or not the Object implementing this interface must or must not participate in state saving or restoring. |
| private static String | |
| public void | validate(FacesContext
FacesContext for the request we are processing context, UIComponent UIComponent we are checking for correctness component, Object the value to validate value)Implements jakarta.
Perform the correctness checks implemented by this |
| initialState | back to summary |
|---|---|
| private boolean initialState | |
| maximum | back to summary |
|---|---|
| private Double maximum | |
| MAXIMUM_MESSAGE_ID | back to summary |
|---|---|
| public static final String MAXIMUM_MESSAGE_ID
The message identifier of the
| |
| minimum | back to summary |
|---|---|
| private Double minimum | |
| MINIMUM_MESSAGE_ID | back to summary |
|---|---|
| public static final String MINIMUM_MESSAGE_ID
The message identifier of the
| |
| NOT_IN_RANGE_MESSAGE_ID | back to summary |
|---|---|
| public static final String NOT_IN_RANGE_MESSAGE_ID
The message identifier of the
| |
| transientValue | back to summary |
|---|---|
| private boolean transientValue | |
| TYPE_MESSAGE_ID | back to summary |
|---|---|
| public static final String TYPE_MESSAGE_ID
The message identifier of the | |
| VALIDATOR_ID | back to summary |
|---|---|
| public static final String VALIDATOR_ID The standard converter id for this converter. | |
| DoubleRangeValidator | back to summary |
|---|---|
| public DoubleRangeValidator()
Construct a | |
| DoubleRangeValidator | back to summary |
|---|---|
| public DoubleRangeValidator(double maximum)
Construct a
| |
| DoubleRangeValidator | back to summary |
|---|---|
| public DoubleRangeValidator(double maximum, double minimum)
Construct a
| |
| clearInitialState | back to summary |
|---|---|
| public void clearInitialState() Implements jakarta. Doc from jakarta. Reset the PartialStateHolder to a non-delta tracking state.
| |
| doubleValue | back to summary |
|---|---|
| private static double doubleValue(Object attributeValue) throws NumberFormatException
Return the specified attribute value, converted to a
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object otherObj) Overrides java. Overrides the default equals method to take the minimum and maximum into account when comparing DoubleRangeValidator instances. | |
| getMaximum | back to summary |
|---|---|
| public double getMaximum()
Return the maximum value to be enforced by this
| |
| getMinimum | back to summary |
|---|---|
| public double getMinimum()
Return the minimum value to be enforced by this
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Overrides the default hash code method to take the minimum and maximum into account when generating the hash code.
| |
| initialStateMarked | back to summary |
|---|---|
| public boolean initialStateMarked() Implements jakarta. Doc from jakarta.
Return
| |
| isMaximumSet | back to summary |
|---|---|
| private boolean isMaximumSet() | |
| isMinimumSet | back to summary |
|---|---|
| private boolean isMinimumSet() | |
| isTransient | back to summary |
|---|---|
| public boolean isTransient() Implements jakarta. Doc from jakarta. If true, the Object implementing this interface must not participate in state saving or restoring.
| |
| markInitialState | back to summary |
|---|---|
| public void markInitialState() Implements jakarta. Doc from jakarta.
The runtime must ensure that the
| |
| restoreState | back to summary |
|---|---|
| public void restoreState(FacesContext context, Object state) Implements jakarta. Doc from jakarta. Perform any processing required to restore the state from the entries in the state Object.
If the class that implements this interface has references to instances that also implement StateHolder (such as a
If the
| |
| saveState | back to summary |
|---|---|
| public Object saveState(FacesContext context) Implements jakarta. Doc from jakarta.
Gets the state of the instance as a
If the class that implements this interface has references to instances that implement StateHolder (such as a
This method must not alter the state of the implementing object. In other words, after executing this code:
The return from this method must be
| |
| setMaximum | back to summary |
|---|---|
| public void setMaximum(double maximum)
Set the maximum value to be enforced by this
| |
| setMinimum | back to summary |
|---|---|
| public void setMinimum(double minimum)
Set the minimum value to be enforced by this
| |
| setTransient | back to summary |
|---|---|
| public void setTransient(boolean transientValue) Implements jakarta. Doc from jakarta. Denotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.
| |
| stringValue | back to summary |
|---|---|
| private static String stringValue(UIComponent component, Double toConvert, FacesContext context) | |
| validate | back to summary |
|---|---|
| public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException Implements jakarta. Doc from jakarta.
Perform the correctness checks implemented by this
For a validator to be fully compliant with Version 2 and later of the specification, it must not fail validation on
| |