|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.behavior.Behavior org.apache.wicket.validation.validator.AbstractRangeValidator<R,V>
R
- type of range valueV
- type of validatablepublic abstract class AbstractRangeValidator<R extends Comparable<R> & Serializable,V extends Serializable>
Base class for validators that check if a given value falls within [min,max] range.
If either min or max are null
they are not checked.
Resource keys:
<class.simpleName>.exact
if min==max<class.simpleName>.range
if both min and max are not null
<class.simpleName>.minimum
if max is null
<class.simpleName>.maximum
if min is null
Error Message Variables:
name
: the id of Component
that failedlabel
: the label of the Component
(either comes from
FormComponent.labelModel
or resource key <form-id>.<form-component-id>
input
: the input valueminimum
: the minimum allowed valuemaximum
: the maximum allowed value
Nested Class Summary | |
---|---|
static class |
AbstractRangeValidator.Mode
Validator mode |
Constructor Summary | |
---|---|
protected |
AbstractRangeValidator()
Constructor used for subclasses who want to set the range using setRange(Comparable, Comparable) |
|
AbstractRangeValidator(R minimum,
R maximum)
Constructor that sets the minimum and maximum values. |
Method Summary | |
---|---|
protected ValidationError |
decorate(ValidationError error,
IValidatable<V> validatable)
Allows subclasses to decorate reported errors |
R |
getMaximum()
Gets the maximum value. |
R |
getMinimum()
Gets the minimum value. |
AbstractRangeValidator.Mode |
getMode()
Gets validation mode which is determined by whether min, max, or both values are provided |
protected abstract R |
getValue(IValidatable<V> validatable)
Gets the value that should be validated against the range |
protected void |
setRange(R minimum,
R maximum)
Sets validator range |
void |
validate(IValidatable<V> validatable)
Validates the IValidatable instance. |
Methods inherited from class org.apache.wicket.behavior.Behavior |
---|
afterRender, beforeRender, bind, canCallListenerInterface, detach, getStatelessHint, isEnabled, isTemporary, onComponentTag, onConfigure, onEvent, onException, onRemove, renderHead, unbind |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractRangeValidator(R minimum, R maximum)
minimum
- the minimum valuemaximum
- the maximum valueprotected AbstractRangeValidator()
setRange(Comparable, Comparable)
Method Detail |
---|
protected final void setRange(R minimum, R maximum)
minimum
- maximum
- public void validate(IValidatable<V> validatable)
IValidator
IValidatable
instance. Validation errors should be reported using
the IValidatable.error(IValidationError)
method.
validate
in interface IValidator<V extends Serializable>
validatable
- the IValidatable
instance being validatedprotected abstract R getValue(IValidatable<V> validatable)
validatable
-
public R getMinimum()
public R getMaximum()
protected ValidationError decorate(ValidationError error, IValidatable<V> validatable)
error
- validatable
-
public final AbstractRangeValidator.Mode getMode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |