Class RangeValidator<Z extends java.lang.Comparable<? super Z> & java.io.Serializable>
- java.lang.Object
-
- org.apache.wicket.behavior.Behavior
-
- org.apache.wicket.validation.validator.AbstractRangeValidator<Z,Z>
-
- org.apache.wicket.validation.validator.RangeValidator<Z>
-
- Type Parameters:
Z- type of validatable
- All Implemented Interfaces:
java.io.Serializable,IComponentAwareEventSink,IComponentAwareHeaderContributor,org.apache.wicket.util.io.IClusterable,IValidator<Z>
- Direct Known Subclasses:
DateValidator
public class RangeValidator<Z extends java.lang.Comparable<? super Z> & java.io.Serializable> extends AbstractRangeValidator<Z,Z>
Validator for checking if a given value falls within [min,max] range. If either min or max arenullthey are not checked.Resource keys:
RangeValidator.exactif min==maxRangeValidator.rangeif both min and max are notnullRangeValidator.minimumif max isnullRangeValidator.maximumif min isnull
Error Message Variables:
name: the id ofComponentthat failedlabel: the label of theComponent(either comes fromFormComponent.labelModelor resource key<form-id>.<form-component-id>input: the input valueminimum: the minimum allowed valuemaximum: the maximum allowed value
- Author:
- igor
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.wicket.validation.validator.AbstractRangeValidator
AbstractRangeValidator.Mode
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRangeValidator()Constructor used for subclasses who want to set the range usingAbstractRangeValidator.setRange(Comparable, Comparable)RangeValidator(Z minimum, Z maximum)Constructor that sets the minimum and maximum values.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ZgetValue(IValidatable<Z> validatable)Gets the value that should be validated against the rangestatic <T extends java.lang.Comparable<? super T> & java.io.Serializable>
RangeValidator<T>maximum(T maximum)static <T extends java.lang.Comparable<? super T> & java.io.Serializable>
RangeValidator<T>minimum(T minimum)static <T extends java.lang.Comparable<? super T> & java.io.Serializable>
RangeValidator<T>range(T minimum, T maximum)-
Methods inherited from class org.apache.wicket.validation.validator.AbstractRangeValidator
decorate, getMaximum, getMinimum, getMode, setRange, validate
-
Methods inherited from class org.apache.wicket.behavior.Behavior
afterRender, beforeRender, bind, canCallListener, detach, getStatelessHint, isEnabled, isTemporary, onAttribute, onComponentTag, onConfigure, onEvent, onException, onRemove, onTag, renderHead, unbind
-
-
-
-
Constructor Detail
-
RangeValidator
public RangeValidator(Z minimum, Z maximum)
Constructor that sets the minimum and maximum values.- Parameters:
minimum- the minimum valuemaximum- the maximum value
-
RangeValidator
protected RangeValidator()
Constructor used for subclasses who want to set the range usingAbstractRangeValidator.setRange(Comparable, Comparable)
-
-
Method Detail
-
range
public static <T extends java.lang.Comparable<? super T> & java.io.Serializable> RangeValidator<T> range(T minimum, T maximum)
- Parameters:
minimum-maximum-- Returns:
- a
RangeValidatorthat validates if a value falls within a range
-
minimum
public static <T extends java.lang.Comparable<? super T> & java.io.Serializable> RangeValidator<T> minimum(T minimum)
- Parameters:
minimum-- Returns:
- a
RangeValidatorthat validates if a value is a leastminimum
-
maximum
public static <T extends java.lang.Comparable<? super T> & java.io.Serializable> RangeValidator<T> maximum(T maximum)
- Parameters:
maximum-- Returns:
- a
RangeValidatorthat validates if a value is a mostmaximum
-
getValue
protected Z getValue(IValidatable<Z> validatable)
Description copied from class:AbstractRangeValidatorGets the value that should be validated against the range
-
-