|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tapestry.valid.BaseValidator org.apache.tapestry.valid.EmailValidator
public class EmailValidator
Simple validation of email strings, to enforce required, and minimum length (maximum length is enforced in the client browser, by setting a maximum input length on the text field).
Field Summary |
---|
Fields inherited from class org.apache.tapestry.valid.BaseValidator |
---|
FIELD_SYMBOL, FORM_SYMBOL, FUNCTION_SYMBOL, VALIDATOR_SYMBOL |
Constructor Summary | |
---|---|
EmailValidator()
|
Method Summary | |
---|---|
protected String |
buildInvalidEmailFormatMessage(IFormComponent field)
|
protected String |
buildMinimumLengthMessage(IFormComponent field)
|
String |
getInvalidEmailFormatMessage()
|
int |
getMinimumLength()
|
String |
getMinimumLengthMessage()
|
String |
getScriptPath()
|
protected boolean |
isValidEmail(String email)
Return true if the email format is valid. |
void |
renderValidatorContribution(IFormComponent field,
IMarkupWriter writer,
IRequestCycle cycle)
This implementation does nothing. |
void |
setInvalidEmailFormatMessage(String string)
Overrides the invalid-email-format
bundle key. |
void |
setMinimumLength(int minimumLength)
|
void |
setMinimumLengthMessage(String string)
Overrides the field-too-short bundle key. |
void |
setScriptPath(String scriptPath)
Allows a developer to use the existing validation logic with a different client-side script. |
Object |
toObject(IFormComponent field,
String input)
Converts input, submitted by the client, into an object value. |
String |
toString(IFormComponent field,
Object value)
Invoked during rendering to convert an object value (which may be null) to a String. |
Methods inherited from class org.apache.tapestry.valid.BaseValidator |
---|
buildRequiredMessage, checkRequired, formatString, formatString, formatString, getPattern, getRequiredMessage, isClientScriptingEnabled, isRequired, processValidatorScript, setClientScriptingEnabled, setRequired, setRequiredMessage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EmailValidator()
Method Detail |
---|
public String toString(IFormComponent field, Object value)
IValidator
public Object toObject(IFormComponent field, 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 String getScriptPath()
public void setScriptPath(String scriptPath)
window.alert()
).
protected boolean isValidEmail(String email)
email
- the email string to validate
public String getInvalidEmailFormatMessage()
public String getMinimumLengthMessage()
public void setInvalidEmailFormatMessage(String string)
invalid-email-format
bundle key.
Parameter {0} is the display name of the field.
public void setMinimumLengthMessage(String string)
field-too-short
bundle key.
Parameter {0} is the minimum length.
Parameter {1} is the display name of the field.
protected String buildMinimumLengthMessage(IFormComponent field)
protected String buildInvalidEmailFormatMessage(IFormComponent field)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |