public abstract class Validator extends Object implements Interceptor
| 构造器和说明 |
|---|
Validator() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
addError(String errorKey,
String errorMessage)
Add message when validate failure.
|
protected String |
getActionKey()
Return the action key of this action.
|
protected Method |
getActionMethod()
Return the method of this action.
|
protected Controller |
getController()
Return the controller of this action.
|
protected String |
getControllerKey()
Return the controller key of this action.
|
protected String |
getDatePattern() |
protected String |
getViewPath()
Return view path of this controller.
|
protected abstract void |
handleError(Controller c)
Handle the validate error.
|
void |
intercept(Invocation invocation) |
protected void |
setDatePattern(String datePattern) |
protected void |
setShortCircuit(boolean shortCircuit) |
protected abstract void |
validate(Controller c)
Use validateXxx method to validate the parameters of this action.
|
protected void |
validateBoolean(int index,
String errorKey,
String errorMessage)
validate boolean for urlPara.
|
protected void |
validateBoolean(String field,
String errorKey,
String errorMessage)
validate boolean.
|
protected void |
validateDate(String field,
Date min,
Date max,
String errorKey,
String errorMessage)
Validate date.
|
protected void |
validateDate(String field,
String errorKey,
String errorMessage)
Validate date.
|
protected void |
validateDate(String field,
String min,
String max,
String errorKey,
String errorMessage)
Validate date.
|
protected void |
validateDouble(String field,
double min,
double max,
String errorKey,
String errorMessage)
Validate double.
|
protected void |
validateDouble(String field,
String errorKey,
String errorMessage)
Validate double.
|
protected void |
validateEmail(String field,
String errorKey,
String errorMessage)
Validate email.
|
protected void |
validateEqualField(String field_1,
String field_2,
String errorKey,
String errorMessage)
Validate equal field.
|
protected void |
validateEqualInteger(Integer i1,
Integer i2,
String errorKey,
String errorMessage)
Validate equal integer.
|
protected void |
validateEqualString(String s1,
String s2,
String errorKey,
String errorMessage)
Validate equal string.
|
protected void |
validateInteger(int index,
int min,
int max,
String errorKey,
String errorMessage)
Validate integer for urlPara.
|
protected void |
validateInteger(int index,
String errorKey,
String errorMessage)
Validate integer for urlPara.
|
protected void |
validateInteger(String field,
int min,
int max,
String errorKey,
String errorMessage)
Validate integer.
|
protected void |
validateInteger(String field,
String errorKey,
String errorMessage)
Validate integer.
|
protected void |
validateLong(int index,
long min,
long max,
String errorKey,
String errorMessage)
Validate long for urlPara.
|
protected void |
validateLong(int index,
String errorKey,
String errorMessage)
Validate long for urlPara.
|
protected void |
validateLong(String field,
long min,
long max,
String errorKey,
String errorMessage)
Validate long.
|
protected void |
validateLong(String field,
String errorKey,
String errorMessage)
Validate long.
|
protected void |
validateRegex(String field,
String regExpression,
boolean isCaseSensitive,
String errorKey,
String errorMessage)
Validate regular expression.
|
protected void |
validateRegex(String field,
String regExpression,
String errorKey,
String errorMessage)
Validate regular expression and case sensitive.
|
protected void |
validateRequired(int index,
String errorKey,
String errorMessage)
Validate Required for urlPara.
|
protected void |
validateRequired(String field,
String errorKey,
String errorMessage)
Validate Required.
|
protected void |
validateRequiredString(int index,
String errorKey,
String errorMessage)
Validate required string for urlPara.
|
protected void |
validateRequiredString(String field,
String errorKey,
String errorMessage)
Validate required string.
|
protected void |
validateString(int index,
int minLen,
int maxLen,
String errorKey,
String errorMessage)
Validate string for urlPara
|
protected void |
validateString(String field,
int minLen,
int maxLen,
String errorKey,
String errorMessage)
Validate string.
|
protected void |
validateToken(String errorKey,
String errorMessage)
Validate token created by Controller.createToken().
|
protected void |
validateToken(String tokenName,
String errorKey,
String errorMessage)
Validate token created by Controller.createToken(String).
|
protected void |
validateUrl(String field,
String errorKey,
String errorMessage)
Validate URL.
|
protected void setShortCircuit(boolean shortCircuit)
protected void setDatePattern(String datePattern)
protected String getDatePattern()
public final void intercept(Invocation invocation)
intercept 在接口中 Interceptorprotected abstract void validate(Controller c)
protected abstract void handleError(Controller c)
protected void addError(String errorKey, String errorMessage)
protected Controller getController()
protected String getActionKey()
protected String getControllerKey()
protected Method getActionMethod()
protected String getViewPath()
protected void validateRequired(String field, String errorKey, String errorMessage)
protected void validateRequired(int index,
String errorKey,
String errorMessage)
protected void validateRequiredString(String field, String errorKey, String errorMessage)
protected void validateRequiredString(int index,
String errorKey,
String errorMessage)
protected void validateInteger(String field, int min, int max, String errorKey, String errorMessage)
protected void validateInteger(int index,
int min,
int max,
String errorKey,
String errorMessage)
protected void validateInteger(String field, String errorKey, String errorMessage)
protected void validateInteger(int index,
String errorKey,
String errorMessage)
protected void validateLong(String field, long min, long max, String errorKey, String errorMessage)
protected void validateLong(int index,
long min,
long max,
String errorKey,
String errorMessage)
protected void validateLong(String field, String errorKey, String errorMessage)
protected void validateLong(int index,
String errorKey,
String errorMessage)
protected void validateDouble(String field, double min, double max, String errorKey, String errorMessage)
protected void validateDouble(String field, String errorKey, String errorMessage)
protected void validateDate(String field, String errorKey, String errorMessage)
protected void validateDate(String field, Date min, Date max, String errorKey, String errorMessage)
protected void validateDate(String field, String min, String max, String errorKey, String errorMessage)
protected void validateEqualField(String field_1, String field_2, String errorKey, String errorMessage)
protected void validateEqualString(String s1, String s2, String errorKey, String errorMessage)
protected void validateEqualInteger(Integer i1, Integer i2, String errorKey, String errorMessage)
protected void validateEmail(String field, String errorKey, String errorMessage)
protected void validateUrl(String field, String errorKey, String errorMessage)
protected void validateRegex(String field, String regExpression, boolean isCaseSensitive, String errorKey, String errorMessage)
protected void validateRegex(String field, String regExpression, String errorKey, String errorMessage)
protected void validateString(String field, int minLen, int maxLen, String errorKey, String errorMessage)
protected void validateString(int index,
int minLen,
int maxLen,
String errorKey,
String errorMessage)
protected void validateToken(String tokenName, String errorKey, String errorMessage)
protected void validateToken(String errorKey, String errorMessage)
protected void validateBoolean(String field, String errorKey, String errorMessage)
Copyright © 2015. All rights reserved.