com.guiseframework.validator
Class DecimalRangeValidator<V extends java.lang.Number & java.lang.Comparable<V>>
java.lang.Object
com.globalmentor.beans.BoundPropertyObject
com.guiseframework.event.GuiseBoundPropertyObject
com.guiseframework.validator.AbstractValidator<V>
com.guiseframework.validator.AbstractRangeValidator<V>
com.guiseframework.validator.AbstractComparableRangeValidator<V>
com.guiseframework.validator.DecimalRangeValidator<V>
- Type Parameters:
V - The value type this validator supports.
- All Implemented Interfaces:
- com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, RangeValidator<V>, Validator<V>
public class DecimalRangeValidator<V extends java.lang.Number & java.lang.Comparable<V>>
- extends AbstractComparableRangeValidator<V>
A range validator for decimal numbers such as floating point numbers that uses BigInteger for validation accuracy.
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
- See Also:
Comparable
| Fields inherited from class com.globalmentor.beans.BoundPropertyObject |
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS |
|
Constructor Summary |
DecimalRangeValidator()
Default constructor with no value required and a step of one. |
DecimalRangeValidator(boolean valueRequired)
Value required constructor with a step of one. |
DecimalRangeValidator(V minimum,
V maximum)
Minimum, and maximum constructor with no step. |
DecimalRangeValidator(V minimum,
V maximum,
boolean valueRequired)
Minimum, maximum, and value required constructor. |
DecimalRangeValidator(V minimum,
V maximum,
V step)
Minimum, maximum, and step constructor. |
DecimalRangeValidator(V minimum,
V maximum,
V step,
boolean valueRequired)
Minimum, maximum, step, and value required constructor. |
|
Method Summary |
protected boolean |
isValidStep(V value,
V step,
V base)
Determines whether the given value falls on the correct step amount relative to the base value. |
| 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.globalmentor.beans.PropertyBindable |
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener |
DecimalRangeValidator
public DecimalRangeValidator()
- Default constructor with no value required and a step of one.
DecimalRangeValidator
public DecimalRangeValidator(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.
DecimalRangeValidator
public DecimalRangeValidator(V minimum,
V maximum)
- Minimum, and maximum constructor with no step.
- 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.
DecimalRangeValidator
public DecimalRangeValidator(V minimum,
V maximum,
V 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.
DecimalRangeValidator
public DecimalRangeValidator(V minimum,
V maximum,
boolean valueRequired)
- Minimum, maximum, 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.valueRequired - Whether the value must be non-null in order to be considered valid.
DecimalRangeValidator
public DecimalRangeValidator(V minimum,
V maximum,
V 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.
isValidStep
protected boolean isValidStep(V value,
V step,
V base)
- Determines whether the given value falls on the correct step amount relative to the base value.
- Specified by:
isValidStep in class AbstractComparableRangeValidator<V extends java.lang.Number & java.lang.Comparable<V>>
- 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.