wicket.markup.html.form.validation
Class LengthValidator

java.lang.Object
  extended by wicket.markup.html.form.validation.AbstractValidator
      extended by wicket.markup.html.form.validation.LengthValidator
All Implemented Interfaces:
java.io.Serializable, IValidator

Deprecated. see StringValidator

public class LengthValidator
extends AbstractValidator

Validates that a form component's string value is of a certain min/max length. Validators are constructed by calling the min, max and range static factory methods. For example, LengthValidator.min(6) would return a validator valid only when the input of the component it is attached to is at least 6 characters long. Likewise, LengthValidator.range(3, 5) would only validate a component containing between 3 and 5 characters (inclusive). Depending on which factory is used to create the validator, one or more of the following parameters are added to the error message interpolation:

Author:
Jonathan Locke
See Also:
Serialized Form

Constructor Summary
protected LengthValidator(boolean checkMin, int min, boolean checkMax, int max)
          Deprecated. Private constructor forces use of static factory method and static instances.
 
Method Summary
 int getMax()
          Deprecated. Gets the upper bound on valid length.
 int getMin()
          Deprecated. Gets the lower bound on valid length.
 boolean isCheckMax()
          Deprecated. Gets whether the maximum bound should be checked.
 boolean isCheckMin()
          Deprecated. Gets whether the minimum bound should be checked.
static LengthValidator max(int max)
          Deprecated. Gets a length validator object that requires a maximum number of characters.
protected  java.util.Map messageModel(FormComponent formComponent)
          Deprecated. Gets the default variables for interpolation.
static LengthValidator min(int min)
          Deprecated. Gets a length validator object that requires a minimum number of characters.
static LengthValidator range(int min, int max)
          Deprecated. Gets a length validator object that requires a minimum and maximum number of characters.
 java.lang.String toString()
          Deprecated.  
 void validate(FormComponent formComponent)
          Deprecated. Validates that a form component's value is of a certain minimum and/or maximum length.
 
Methods inherited from class wicket.markup.html.form.validation.AbstractValidator
error, error, error, error, resourceKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LengthValidator

protected LengthValidator(boolean checkMin,
                          int min,
                          boolean checkMax,
                          int max)
Deprecated. 
Private constructor forces use of static factory method and static instances. Or override it to implement resourceKey(Component)

Parameters:
checkMin - True if minimum bound should be checked
min - Lower bound on valid length
checkMax - True if maximum bound should be checked
max - Upper bound on valid length
Method Detail

min

public static final LengthValidator min(int min)
Deprecated. 
Gets a length validator object that requires a minimum number of characters.

Parameters:
min - Minimum number of characters
Returns:
Validator object

max

public static final LengthValidator max(int max)
Deprecated. 
Gets a length validator object that requires a maximum number of characters.

Parameters:
max - Maximum number of characters
Returns:
Validator object

range

public static final LengthValidator range(int min,
                                          int max)
Deprecated. 
Gets a length validator object that requires a minimum and maximum number of characters.

Parameters:
min - Minimum number of characters
max - Maximum number of characters
Returns:
Validator object

validate

public final void validate(FormComponent formComponent)
Deprecated. 
Validates that a form component's value is of a certain minimum and/or maximum length.

Parameters:
formComponent - Component to validate
See Also:
IValidator.validate(wicket.markup.html.form.FormComponent)

isCheckMax

public final boolean isCheckMax()
Deprecated. 
Gets whether the maximum bound should be checked.

Returns:
whether the minimum bound should be checked

isCheckMin

public final boolean isCheckMin()
Deprecated. 
Gets whether the minimum bound should be checked.

Returns:
whether the minimum bound should be checked

getMax

public final int getMax()
Deprecated. 
Gets the upper bound on valid length.

Returns:
the upper bound on valid length

getMin

public final int getMin()
Deprecated. 
Gets the lower bound on valid length.

Returns:
the lower bound on valid length

messageModel

protected java.util.Map messageModel(FormComponent formComponent)
Deprecated. 
Gets the default variables for interpolation. These are: they are only added when the corresponding enabling flag is set.

Overrides:
messageModel in class AbstractValidator
Parameters:
formComponent - form component
Returns:
a map with the variables for interpolation

toString

public java.lang.String toString()
Deprecated. 
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2004-2007 Wicket developers. All Rights Reserved.