org.apache.myfaces.trinidad.validator
Class LongRangeValidator

java.lang.Object
  extended by javax.faces.validator.LongRangeValidator
      extended by org.apache.myfaces.trinidad.validator.LongRangeValidator
All Implemented Interfaces:
java.util.EventListener, javax.faces.component.StateHolder, javax.faces.validator.Validator

public class LongRangeValidator
extends javax.faces.validator.LongRangeValidator

Implementation for java.lang.Long values.


Field Summary
static java.lang.String CONVERT_MESSAGE_ID
          The message identifier of the FacesMessage to be created if the value cannot be converted to an integer
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
           
 
Fields inherited from class javax.faces.validator.LongRangeValidator
TYPE_MESSAGE_ID
 
Constructor Summary
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.
 
Method Summary
 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.
 long 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.
 long 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.
protected  boolean isMaximumSet()
           
protected  boolean isMinimumSet()
           
 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(long 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(long 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 javax.faces.validator.LongRangeValidator
equals
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATOR_ID

public static final java.lang.String VALIDATOR_ID
See Also:
Constant Field Values

MAXIMUM_MESSAGE_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.

See Also:
Constant Field Values

MINIMUM_MESSAGE_ID

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.

See Also:
Constant Field Values

NOT_IN_RANGE_MESSAGE_ID

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.

See Also:
Constant Field Values

CONVERT_MESSAGE_ID

public static final java.lang.String CONVERT_MESSAGE_ID

The message identifier of the FacesMessage to be created if the value cannot be converted to an integer

See Also:
Constant Field Values
Constructor Detail

LongRangeValidator

public LongRangeValidator()
Construct a Validator with no preconfigured limits.


LongRangeValidator

public LongRangeValidator(long maximum)
Construct a Validator with the specified preconfigured limit.

Parameters:
maximum - Maximum value to allow

LongRangeValidator

public LongRangeValidator(long maximum,
                          long minimum)
Construct a Validator with the specified preconfigured limits.

Parameters:
maximum - Maximum value to allow
minimum - Minimum value to allow
Method Detail

getMaximum

public long getMaximum()
Return the maximum value to be enforced by this Validator or null if it has not been set.

Overrides:
getMaximum in class javax.faces.validator.LongRangeValidator

setMaximum

public void setMaximum(long maximum)
Set the maximum value to be enforced by this Validator.

Overrides:
setMaximum in class javax.faces.validator.LongRangeValidator
Parameters:
maximum - The new maximum value

getMinimum

public long getMinimum()
Return the minimum value to be enforced by this Validator, or null if it has not been set.

Overrides:
getMinimum in class javax.faces.validator.LongRangeValidator

setMinimum

public void setMinimum(long minimum)
Set the minimum value to be enforced by this Validator.

Overrides:
setMinimum in class javax.faces.validator.LongRangeValidator
Parameters:
minimum - The new minimum value

setMessageDetailMaximum

public 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.

Overrides detail message identified by message id MAXIMUM_MESSAGE_ID

Parameters:
maximumMessageDetail - Custom error message.

getMessageDetailMaximum

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.

Returns:
Custom error message.
See Also:
setMessageDetailMaximum(String)

setMessageDetailMinimum

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.

Overrides detail message identified by message id MINIMUM_MESSAGE_ID

Parameters:
minimumMessageDetail - Custom error message.

getMessageDetailMinimum

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.

Returns:
Custom error message.
See Also:
setMessageDetailMinimum(String)

setMessageDetailNotInRange

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.

Overrides detail message identified by message id NOT_IN_RANGE_MESSAGE_ID

Parameters:
notInRangeMessageDetail - Custom error message.

getMessageDetailNotInRange

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.

Returns:
Custom error message.
See Also:
setMessageDetailNotInRange(String)

setHintMaximum

public void setHintMaximum(java.lang.String hintMaximum)

Custom hint maximum message.

Overrides default hint message

Parameters:
hintMaximum - Custom hint message.

getHintMaximum

public java.lang.String getHintMaximum()

Return custom hint maximum message.

Returns:
Custom hint message.
See Also:
setHintMaximum(String)

setHintMinimum

public void setHintMinimum(java.lang.String hintMinimum)

Custom hint minimum message.

Overrides default hint message

Parameters:
hintMinimum - Custom hint message.

getHintMinimum

public java.lang.String getHintMinimum()

Return custom hint minimum message.

Returns:
Custom hint message.
See Also:
setHintMinimum(String)

setHintNotInRange

public void setHintNotInRange(java.lang.String hintNotInRange)

Custom hint notInRange message.

Overrides default hint message

Parameters:
hintNotInRange - Custom hint message.

getHintNotInRange

public java.lang.String getHintNotInRange()

Return custom hint notInRange message.

Returns:
Custom hint message.
See Also:
setHintNotInRange(java.lang.String)

validate

public void validate(javax.faces.context.FacesContext context,
                     javax.faces.component.UIComponent component,
                     java.lang.Object value)
              throws javax.faces.validator.ValidatorException
Specified by:
validate in interface javax.faces.validator.Validator
Overrides:
validate in class javax.faces.validator.LongRangeValidator
Throws:
javax.faces.validator.ValidatorException

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class javax.faces.validator.LongRangeValidator

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class javax.faces.validator.LongRangeValidator

setValueBinding

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.

Parameters:
name - Name of the attribute for which to set a ValueBinding
binding - The ValueBinding to set, or null to remove any currently set ValueBinding
Throws:
java.lang.NullPointerException - if name is null
java.lang.IllegalArgumentException - if name is not a valid attribute of this validator

getValueBinding

public javax.faces.el.ValueBinding getValueBinding(java.lang.String name)

Return the ValueBinding used to calculate the value for the specified attribute name, if any.

Parameters:
name - Name of the attribute or property for which to retrieve a ValueBinding
Throws:
java.lang.NullPointerException - if name is null
java.lang.IllegalArgumentException - if name is not a valid attribute of this validator

isTransient

public boolean isTransient()
Specified by:
isTransient in interface javax.faces.component.StateHolder
Overrides:
isTransient in class javax.faces.validator.LongRangeValidator

setTransient

public void setTransient(boolean transientValue)
Specified by:
setTransient in interface javax.faces.component.StateHolder
Overrides:
setTransient in class javax.faces.validator.LongRangeValidator

isMaximumSet

protected boolean isMaximumSet()

isMinimumSet

protected boolean isMinimumSet()


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.