|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wicket.markup.html.form.validation.AbstractValidator wicket.markup.html.form.validation.StringValidator
public abstract class StringValidator
A validator for strings that can be used for subclassing or use one of the static factory methods to get the default string validators as range, maximum or minimum.
Constructor Summary | |
---|---|
StringValidator()
|
Method Summary | |
---|---|
static StringValidator |
exactLength(int length)
Gets a String exact length validator to check if a string length is exactly the same as the given value If that is not the case then an error message will be generated with the key "StringValidator.exact" and the messages keys that can be used are: ${exact}: the maximum length ${length}: the length of the user input ${input}: the input the user did give ${name}: the name of the component that failed ${label}: the label of the component - either comes from FormComponent.labelModel or resource key [form-id].[form-component-id] in that order |
static StringValidator |
lengthBetween(int minimum,
int maximum)
Gets a String range validator to check if a string length is between min and max. |
static StringValidator |
maximumLength(int maximum)
Gets a String maximum validator to check if a string length is smaller then the given maximum value. |
static StringValidator |
minimumLength(int minimum)
Gets a String minimum validator to check if a string length is greater then the given minimum value. |
abstract void |
onValidate(FormComponent formComponent,
java.lang.String value)
Subclasses should override this method to validate the string value for a component. |
void |
validate(FormComponent formComponent)
Instead of subclassing IValidator, you should use one of the existing validators, which cover a huge number of cases, or if none satisfies your need, subclass one of the Type validators like StringValidator ,
NumberValidator or DateValidator |
Methods inherited from class wicket.markup.html.form.validation.AbstractValidator |
---|
error, error, error, error, messageModel, resourceKey |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StringValidator()
Method Detail |
---|
public static StringValidator lengthBetween(int minimum, int maximum)
minimum
- The minimum length of the string.maximum
- The maximum length of the string.
public static StringValidator minimumLength(int minimum)
minimum
- The minimum length of the string.
public static StringValidator maximumLength(int maximum)
maximum
- The maximum length of the string.
public static StringValidator exactLength(int length)
length
- The required length of the string.
public void validate(FormComponent formComponent)
IValidator
Instead of subclassing IValidator, you should use one of the existing
validators, which cover a huge number of cases, or if none satisfies your
need, subclass one of the Type validators like StringValidator
,
NumberValidator
or DateValidator
Validates the given input. The input corresponds to the input from the request for a component.
formComponent
- Component to validateIValidator.validate(wicket.markup.html.form.FormComponent)
public abstract void onValidate(FormComponent formComponent, java.lang.String value)
formComponent
- form componentvalue
- The string value to validate
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |