R - type of range valueV - type of validatablepublic abstract class AbstractRangeValidator<R extends Comparable<? super R> & Serializable,V extends Serializable> extends Behavior implements IValidator<V>
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 nullError 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| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractRangeValidator.Mode
Validator mode
|
| Modifier | Constructor and Description |
|---|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
protected IValidationError |
decorate(IValidationError 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. |
afterRender, beforeRender, bind, canCallListenerInterface, detach, getStatelessHint, isEnabled, isTemporary, onComponentTag, onConfigure, onEvent, onException, onRemove, renderHead, unbindpublic AbstractRangeValidator(R minimum, R maximum)
minimum - the minimum valuemaximum - the maximum valueprotected AbstractRangeValidator()
setRange(Comparable, Comparable)protected final void setRange(R minimum, R maximum)
minimum - maximum - public void validate(IValidatable<V> validatable)
IValidatorIValidatable 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 IValidationError decorate(IValidationError error, IValidatable<V> validatable)
error - validatable - public final AbstractRangeValidator.Mode getMode()
Copyright © 2006–2021 Apache Software Foundation. All rights reserved.