|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.trinidad.validator.DateTimeRangeValidator
public class DateTimeRangeValidator
DateTimeRangeValidator is a Validator
that checks
the value of the corresponding component against specified minimum and
maximum dates. The following algorithm is implemented:
null
, exit immediately.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
Validator.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.The detail part of faces message which arise during validation can be customised by overriding the message associated with each message id by calling appropriate setter methods.
The methods used for customizing the detail message associated with each id is given below:
MAXIMUM_MESSAGE_ID
- setMessageDetailMaximum(String)
MINIMUM_MESSAGE_ID
- setMessageDetailMinimum(String)
NOT_IN_RANGE_MESSAGE_ID
- setMessageDetailNotInRange(String)
-
Field Summary | |
---|---|
static java.lang.String |
MAXIMUM_MESSAGE_ID
The message identifier of the FacesMessage
to be created if the maximum value check fails. |
static java.lang.String |
MINIMUM_MESSAGE_ID
The message identifier of the FacesMessage
to be created if the minimum value check fails. |
static java.lang.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 java.lang.String |
VALIDATOR_ID
|
Constructor Summary | |
---|---|
DateTimeRangeValidator()
Construct a Validator with no preconfigured limits. |
|
DateTimeRangeValidator(java.util.Date maximum)
Construct a Validator with the specified preconfigured
limit. |
|
DateTimeRangeValidator(java.util.Date maximum,
java.util.Date minimum)
Construct a Validator with the specified preconfigured
limits. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
|
java.lang.String |
getHintMaximum()
Return custom hint maximum message. |
java.lang.String |
getHintMinimum()
Return custom hint minimum message. |
java.lang.String |
getHintNotInRange()
Return custom hint notInRange message. |
java.util.Date |
getMaximum()
Return the maximum value to be enforced by this Validator or null if it has not been
set. |
java.lang.String |
getMessageDetailMaximum()
Return custom detail error message that was set for creating FacesMessage ,
for cases where input value exceeds the maximum value set. |
java.lang.String |
getMessageDetailMinimum()
Return custom detail error message that was set for creating FacesMessage ,
for cases where, input value is less than the minimum value set. |
java.lang.String |
getMessageDetailNotInRange()
Return custom detail error message that was set for creating FacesMessage ,
for cases where, input value exceeds the maximum value and is
less than the minimum value set. |
java.util.Date |
getMinimum()
Return the minimum value to be enforced by this Validator , or null if it has not been
set. |
javax.faces.el.ValueBinding |
getValueBinding(java.lang.String name)
Return the ValueBinding used to calculate the value for the
specified attribute name, if any. |
int |
hashCode()
|
boolean |
isTransient()
|
void |
restoreState(javax.faces.context.FacesContext context,
java.lang.Object state)
|
java.lang.Object |
saveState(javax.faces.context.FacesContext context)
|
void |
setHintMaximum(java.lang.String hintMaximum)
Custom hint maximum message. |
void |
setHintMinimum(java.lang.String hintMinimum)
Custom hint minimum message. |
void |
setHintNotInRange(java.lang.String hintNotInRange)
Custom hint notInRange message. |
void |
setMaximum(java.util.Date maximum)
Set the maximum value to be enforced by this Validator . |
void |
setMessageDetailMaximum(java.lang.String maximumMessageDetail)
Custom error message to be used, for creating detail part of the FacesMessage , when input value exceeds the maximum value set. |
void |
setMessageDetailMinimum(java.lang.String minimumMessageDetail)
Custom error message to be used, for creating detail part of the FacesMessage , when input value is less the set
minimum value. |
void |
setMessageDetailNotInRange(java.lang.String notInRangeMessageDetail)
Custom error message to be used, for creating detail part of the FacesMessage , when input value is not with in the range,
when minimum and maximum is set. |
void |
setMinimum(java.util.Date minimum)
Set the minimum value to be enforced by this Validator . |
void |
setTransient(boolean transientValue)
|
void |
setValueBinding(java.lang.String name,
javax.faces.el.ValueBinding binding)
Set the ValueBinding used to calculate the value for the
specified attribute if any. |
void |
validate(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object value)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String VALIDATOR_ID
public static final java.lang.String MAXIMUM_MESSAGE_ID
The message identifier of the FacesMessage
to be created if the maximum value check fails. The message format
string for this message may optionally include {0}
,
{1}
and {3}
placeholders,
which will be replaced by user input, component label and configured
maximum value.
public static final java.lang.String MINIMUM_MESSAGE_ID
The message identifier of the FacesMessage
to be created if the minimum value check fails. The message format
string for this message may optionally include {0}
,
{1}
and {2}
placeholders, which will be replaced
by user input, component label and configured minimum value.
public static final java.lang.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.
The message format string for this message may optionally include
{0}
, {1}
, {2}
and {3}
placeholders, which will be replaced by user input, component label,
configured minimum value and configured maximum value.
Constructor Detail |
---|
public DateTimeRangeValidator()
Validator
with no preconfigured limits.
public DateTimeRangeValidator(java.util.Date maximum)
Validator
with the specified preconfigured
limit.
maximum
- Maximum value to allowpublic DateTimeRangeValidator(java.util.Date maximum, java.util.Date minimum)
Validator
with the specified preconfigured
limits.
maximum
- Maximum value to allowminimum
- Minimum value to allowMethod Detail |
---|
public java.util.Date getMaximum()
Validator
or null if it has not been
set.
public void setMaximum(java.util.Date maximum)
Validator
.
maximum
- The new maximum valuepublic java.util.Date getMinimum()
Validator
, or null if it has not been
set.
public void setMinimum(java.util.Date minimum)
Validator
.
minimum
- The new minimum valuepublic void setMessageDetailMaximum(java.lang.String maximumMessageDetail)
Custom error message to be used, for creating detail part of the
FacesMessage
, when input value exceeds the maximum value set.
MAXIMUM_MESSAGE_ID
maximumMessageDetail
- Custom error message.public java.lang.String getMessageDetailMaximum()
Return custom detail error message that was set for creating FacesMessage
,
for cases where input value exceeds the maximum
value set.
setMessageDetailMaximum(String)
public void setMessageDetailMinimum(java.lang.String minimumMessageDetail)
Custom error message to be used, for creating detail part of the
FacesMessage
, when input value is less the set
minimum
value.
MINIMUM_MESSAGE_ID
minimumMessageDetail
- Custom error message.public java.lang.String getMessageDetailMinimum()
Return custom detail error message that was set for creating FacesMessage
,
for cases where, input value is less than the minimum
value set.
setMessageDetailMinimum(String)
public void setMessageDetailNotInRange(java.lang.String notInRangeMessageDetail)
Custom error message to be used, for creating detail part of the
FacesMessage
, when input value is not with in the range,
when minimum
and maximum
is set.
NOT_IN_RANGE_MESSAGE_ID
notInRangeMessageDetail
- Custom error message.public java.lang.String getMessageDetailNotInRange()
Return custom detail error message that was set for creating FacesMessage
,
for cases where, input value exceeds the maximum
value and is
less than the minimum
value set.
setMessageDetailNotInRange(String)
public void setHintMaximum(java.lang.String hintMaximum)
Custom hint maximum message.
Overrides default hint message
hintMaximum
- Custom hint message.public java.lang.String getHintMaximum()
Return custom hint maximum message.
setHintMaximum(String)
public void setHintMinimum(java.lang.String hintMinimum)
Custom hint minimum message.
Overrides default hint message
hintMinimum
- Custom hint message.public java.lang.String getHintMinimum()
Return custom hint minimum message.
setHintMinimum(String)
public void setHintNotInRange(java.lang.String hintNotInRange)
Custom hint notInRange message.
Overrides default hint message
hintNotInRange
- Custom hint message.public java.lang.String getHintNotInRange()
Return custom hint notInRange message.
setHintNotInRange(String)
public void validate(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object value) throws javax.faces.validator.ValidatorException
validate
in interface javax.faces.validator.Validator
java.lang.IllegalArgumentException
- if value
is not of type
Date
javax.faces.validator.ValidatorException
public java.lang.Object saveState(javax.faces.context.FacesContext context)
saveState
in interface javax.faces.component.StateHolder
public void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
restoreState
in interface javax.faces.component.StateHolder
public void setValueBinding(java.lang.String name, javax.faces.el.ValueBinding binding)
Set the ValueBinding
used to calculate the value for the
specified attribute if any.
name
- Name of the attribute for which to set a ValueBinding
binding
- The ValueBinding
to set, or null
to remove any currently set ValueBinding
java.lang.NullPointerException
- if name
is null
java.lang.IllegalArgumentException
- if name
is not a valid
attribute of this validatorpublic javax.faces.el.ValueBinding getValueBinding(java.lang.String name)
Return the ValueBinding
used to calculate the value for the
specified attribute name, if any.
name
- Name of the attribute or property for which to retrieve a
ValueBinding
java.lang.NullPointerException
- if name
is null
java.lang.IllegalArgumentException
- if name
is not a valid
attribute of this validatorpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean isTransient()
isTransient
in interface javax.faces.component.StateHolder
public void setTransient(boolean transientValue)
setTransient
in interface javax.faces.component.StateHolder
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |