|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.globalmentor.beans.BoundPropertyObject
com.guiseframework.event.GuiseBoundPropertyObject
com.guiseframework.validator.AbstractValidator<V>
com.guiseframework.validator.AbstractRangeValidator<V>
com.guiseframework.validator.AbstractComparableRangeValidator<V>
V - The value type this validator supports.public abstract class AbstractComparableRangeValidator<V extends java.lang.Comparable<V>>
An abstract implementation of a range validator that handles comparable values. 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.
Comparable| 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 | |
|---|---|
AbstractComparableRangeValidator(V minimum,
V maximum,
V step,
boolean valueRequired)
Minimum, maximum, step, and value required constructor. |
|
| Method Summary | |
|---|---|
protected abstract boolean |
isValidStep(V value,
V step,
V base)
Determines whether the given value falls on the correct step amount relative to the base value. |
void |
validate(V value)
Determines whether a given value is valid is within the specified range. |
| 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 |
|---|
public AbstractComparableRangeValidator(V minimum,
V maximum,
V step,
boolean valueRequired)
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 |
|---|
public void validate(V value)
throws ValidationException
#isValidStep(Number, Number, Number) for checking step compliance.
Child classes will normally not override this class and instead merely implement #isValidStep(Number, Number, Number).
validate in interface Validator<V extends java.lang.Comparable<V>>validate in class AbstractValidator<V extends java.lang.Comparable<V>>value - The value to validate, which may be null.
ValidationException - if the provided value is not valid.AbstractValidator.throwInvalidValueValidationException(Object),
AbstractValidator.throwValueRequiredValidationException(Object)
protected abstract boolean isValidStep(V value,
V step,
V base)
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.
true if the value is a valid step away from the given base.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||