com.guiseframework.validator
Class LongRangeValidator

java.lang.Object
  extended by com.globalmentor.beans.BoundPropertyObject
      extended by com.guiseframework.event.GuiseBoundPropertyObject
          extended by com.guiseframework.validator.AbstractValidator<V>
              extended by com.guiseframework.validator.AbstractRangeValidator<V>
                  extended by com.guiseframework.validator.AbstractComparableRangeValidator<java.lang.Long>
                      extended by com.guiseframework.validator.LongRangeValidator
All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, RangeValidator<java.lang.Long>, Validator<java.lang.Long>

public class LongRangeValidator
extends AbstractComparableRangeValidator<java.lang.Long>

A range validator for longs. The step value is considered relative either to the minimum value, if available, the maximum value, if available, or zero, in that order or priority.

Author:
Garret Wilson

Field Summary
 
Fields inherited from class com.globalmentor.beans.BoundPropertyObject
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
 
Fields inherited from interface com.guiseframework.validator.Validator
INVALID_VALUE_MESSAGE_PROPERTY, VALUE_REQUIRED_MESSAGE_PROPERTY, VALUE_REQUIRED_PROPERTY
 
Constructor Summary
LongRangeValidator()
          Default constructor with no value required and a step of one.
LongRangeValidator(boolean valueRequired)
          Value required constructor with a step of one.
LongRangeValidator(java.lang.Long maximum)
          Maximum constructor with a minimum value of zero and a step of one.
LongRangeValidator(java.lang.Long maximum, boolean valueRequired)
          Minimum and value required constructor with a minimum value of zero and a step of one.
LongRangeValidator(java.lang.Long minimum, java.lang.Long maximum)
          Minimum and maximum constructor with a step of one.
LongRangeValidator(java.lang.Long minimum, java.lang.Long maximum, boolean valueRequired)
          Minimum, maximum, and value required constructor with a step of one.
LongRangeValidator(java.lang.Long minimum, java.lang.Long maximum, java.lang.Long step)
          Minimum, maximum, and step constructor.
LongRangeValidator(java.lang.Long minimum, java.lang.Long maximum, java.lang.Long step, boolean valueRequired)
          Minimum, maximum, step, and value required constructor.
 
Method Summary
protected  boolean isValidStep(java.lang.Long value, java.lang.Long step, java.lang.Long base)
          Determines whether the given value falls on the correct step amount relative to the base value.
 
Methods inherited from class com.guiseframework.validator.AbstractComparableRangeValidator
validate
 
Methods inherited from class com.guiseframework.validator.AbstractRangeValidator
getMaximum, getMinimum, getStep
 
Methods inherited from class com.guiseframework.validator.AbstractValidator
getInvalidValueMessage, getValueRequiredMessage, isValid, isValueRequired, setInvalidValueMessage, setValueRequired, setValueRequiredMessage, throwInvalidValueValidationException, throwValueRequiredValidationException, toString
 
Methods inherited from class com.guiseframework.event.GuiseBoundPropertyObject
getSession
 
Methods inherited from class com.globalmentor.beans.BoundPropertyObject
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.guiseframework.validator.Validator
getInvalidValueMessage, getSession, getValueRequiredMessage, isValid, setInvalidValueMessage, setValueRequiredMessage
 
Methods inherited from interface com.globalmentor.beans.PropertyBindable
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

LongRangeValidator

public LongRangeValidator()
Default constructor with no value required and a step of one.


LongRangeValidator

public LongRangeValidator(boolean valueRequired)
Value required constructor with a step of one.

Parameters:
valueRequired - Whether the value must be non-null in order to be considered valid.

LongRangeValidator

public LongRangeValidator(java.lang.Long maximum)
Maximum constructor with a minimum value of zero and a step of one.

Parameters:
maximum - The maximum value, inclusive, or null if the range has no upper bound.

LongRangeValidator

public LongRangeValidator(java.lang.Long minimum,
                          java.lang.Long maximum)
Minimum and maximum constructor with a step of one.

Parameters:
minimum - The minimum value, inclusive, or null if the range has no lower bound.
maximum - The maximum value, inclusive, or null if the range has no upper bound.

LongRangeValidator

public LongRangeValidator(java.lang.Long minimum,
                          java.lang.Long maximum,
                          java.lang.Long step)
Minimum, maximum, and step constructor.

Parameters:
minimum - The minimum value, inclusive, or null if the range has no lower bound.
maximum - The maximum value, inclusive, or null if the range has no upper bound.
step - The step amount, or null if the range has no increment value specified.

LongRangeValidator

public LongRangeValidator(java.lang.Long maximum,
                          boolean valueRequired)
Minimum and value required constructor with a minimum value of zero and a step of one.

Parameters:
maximum - The maximum value, inclusive, or null if the range has no upper bound.
valueRequired - Whether the value must be non-null in order to be considered valid.

LongRangeValidator

public LongRangeValidator(java.lang.Long minimum,
                          java.lang.Long maximum,
                          boolean valueRequired)
Minimum, maximum, and value required constructor with a step of one.

Parameters:
minimum - The minimum value, inclusive, or null if the range has no lower bound.
maximum - The maximum value, inclusive, or null if the range has no upper bound.
valueRequired - Whether the value must be non-null in order to be considered valid.

LongRangeValidator

public LongRangeValidator(java.lang.Long minimum,
                          java.lang.Long maximum,
                          java.lang.Long step,
                          boolean valueRequired)
Minimum, maximum, step, and value required constructor.

Parameters:
minimum - The minimum value, inclusive, or null if the range has no lower bound.
maximum - The maximum value, inclusive, or null if the range has no upper bound.
step - The step amount, or null if the range has no increment value specified.
valueRequired - Whether the value must be non-null in order to be considered valid.
Method Detail

isValidStep

protected boolean isValidStep(java.lang.Long value,
                              java.lang.Long step,
                              java.lang.Long base)
Determines whether the given value falls on the correct step amount relative to the base value.

Specified by:
isValidStep in class AbstractComparableRangeValidator<java.lang.Long>
Parameters:
value - The value to validate.
step - The step value.
base - The base (either the minimum or maximum value), or null if zero should be used as a base.
Returns:
true if the value is a valid step away from the given base.


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.