public class StringValidator extends BaseValidator
FIELD_SYMBOL, FORM_SYMBOL, FUNCTION_SYMBOL, VALIDATOR_SYMBOL
Constructor and Description |
---|
StringValidator() |
StringValidator(java.lang.String initializer)
Initializes the StringValidator with properties defined by the initializer.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
buildMinimumLengthMessage(IFormComponent field) |
int |
getMinimumLength() |
java.lang.String |
getMinimumLengthMessage() |
java.lang.String |
getScriptPath() |
void |
renderValidatorContribution(IFormComponent field,
IMarkupWriter writer,
IRequestCycle cycle)
This implementation does nothing.
|
void |
setMinimumLength(int minimumLength) |
void |
setMinimumLengthMessage(java.lang.String string)
Overrides the
field-too-short bundle key. |
void |
setScriptPath(java.lang.String scriptPath)
Allows a developer to use the existing validation logic with a different client-side script.
|
java.lang.Object |
toObject(IFormComponent field,
java.lang.String input)
Converts input, submitted by the client, into an object value.
|
java.lang.String |
toString(IFormComponent field,
java.lang.Object value)
Invoked during rendering to convert an object value (which may be null) to a String.
|
buildRequiredMessage, checkRequired, formatString, formatString, formatString, getPattern, getRequiredMessage, isClientScriptingEnabled, isRequired, processValidatorScript, setClientScriptingEnabled, setRequired, setRequiredMessage
public StringValidator()
public StringValidator(java.lang.String initializer)
public java.lang.String toString(IFormComponent field, java.lang.Object value)
IValidator
public java.lang.Object toObject(IFormComponent field, java.lang.String input) throws ValidatorException
IValidator
The input string will already have been trimmed. It may be null.
ValidatorException
- if the string cannot be converted into an object, or the object is not valid (due
to other constraints).public int getMinimumLength()
public void setMinimumLength(int minimumLength)
public void renderValidatorContribution(IFormComponent field, IMarkupWriter writer, IRequestCycle cycle)
BaseValidator
renderValidatorContribution
in interface IValidator
renderValidatorContribution
in class BaseValidator
public java.lang.String getScriptPath()
public void setScriptPath(java.lang.String scriptPath)
window.alert()
).public java.lang.String getMinimumLengthMessage()
public void setMinimumLengthMessage(java.lang.String string)
field-too-short
bundle key. Parameter {0} is the minimum length.
Parameter {1} is the display name of the field.protected java.lang.String buildMinimumLengthMessage(IFormComponent field)