|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.slim3.controller.validator.Validators
public class Validators
A class to control validation process. The error messages of validation are stored in application[_locale].properties.
| Field Summary | |
|---|---|
protected Errors |
errors
The error messages. |
protected Map<String,Object> |
parameters
The parameters. |
protected ArrayMap<String,Validator[]> |
validatorsMap
The registered validators. |
| Constructor Summary | |
|---|---|
Validators(HttpServletRequest request)
Constructor. |
|
Validators(Map<String,Object> parameters)
Constructor. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ArrayMap<String,Validator[]> validatorsMap
protected Map<String,Object> parameters
protected Errors errors
| Constructor Detail |
|---|
public Validators(HttpServletRequest request)
request - the request
public Validators(Map<String,Object> parameters)
throws NullPointerException,
IllegalStateException
parameters - the parameters
NullPointerException - if the parameters parameter is null
IllegalStateException - if the errors is not found in parameters| Method Detail |
|---|
public Validators add(CharSequence name,
Validator... validators)
throws NullPointerException
name - the parameter namevalidators - the validators
NullPointerException - if the name parameter is nullpublic boolean validate()
public Errors getErrors()
public RequiredValidator required()
RequiredValidator. The key of error message is
"validator.required".
RequiredValidatorpublic RequiredValidator required(String message)
RequiredValidator.
message - the error message
RequiredValidatorpublic ByteTypeValidator byteType()
ByteTypeValidator. The key of error message is
"validator.byteType".
ByteTypeValidatorpublic ByteTypeValidator byteType(String message)
ByteTypeValidator.
message - the error message
ByteTypeValidatorpublic ShortTypeValidator shortType()
ShortTypeValidator. The key of error message is
"validator.shortType".
ShortTypeValidatorpublic ShortTypeValidator shortType(String message)
ShortTypeValidator.
message - the error message
ShortTypeValidatorpublic IntegerTypeValidator integerType()
IntegerTypeValidator. The key of error message is
"validator.integerType".
IntegerTypeValidatorpublic IntegerTypeValidator integerType(String message)
IntegerTypeValidator.
message - the error message
IntegerTypeValidatorpublic LongTypeValidator longType()
LongTypeValidator. The key of error message is
"validator.longType".
LongTypeValidatorpublic LongTypeValidator longType(String message)
LongTypeValidator.
message - the error message
LongTypeValidatorpublic FloatTypeValidator floatType()
FloatTypeValidator. The key of error message is
"validator.floatType".
FloatTypeValidatorpublic FloatTypeValidator floatType(String message)
FloatTypeValidator.
message - the error message
FloatTypeValidatorpublic DoubleTypeValidator doubleType()
DoubleTypeValidator. The key of error message is
"validator.doubleType".
DoubleTypeValidatorpublic DoubleTypeValidator doubleType(String message)
DoubleTypeValidator.
message - the error message
DoubleTypeValidatorpublic NumberTypeValidator numberType(String pattern)
NumberTypeValidator. The key of error message is
"validator.numberType".
pattern - the pattern of DecimalFormat
NumberTypeValidator
public NumberTypeValidator numberType(String pattern,
String message)
NumberTypeValidator.
pattern - the pattern of DecimalFormatmessage - the error message
NumberTypeValidatorpublic DateTypeValidator dateType(String pattern)
DateTypeValidator. The key of error message is
"validator.dateType".
pattern - the pattern of SimpleDateFormat
DateTypeValidator
public DateTypeValidator dateType(String pattern,
String message)
DateTypeValidator.
pattern - the pattern of SimpleDateFormatmessage - the error message
DateTypeValidatorpublic MinlengthValidator minlength(int minlength)
MinlengthValidator. The key of error message is
"validator.minlength".
minlength - the minimum length
MinlengthValidator
public MinlengthValidator minlength(int minlength,
String message)
MinlengthValidator.
minlength - the minimum lengthmessage - the error message
MinlengthValidatorpublic MaxlengthValidator maxlength(int maxlength)
MaxlengthValidator. The key of error message is
"validator.maxlength".
maxlength - the maximum length
MaxlengthValidator
public MaxlengthValidator maxlength(int maxlength,
String message)
MaxlengthValidator.
maxlength - the maximum lengthmessage - the error message
MaxlengthValidator
public LongRangeValidator longRange(long minimum,
long maximum)
LongRangeValidator. The key of error message is
"validator.range".
minimum - the minimum valuemaximum - the maximum value
LongRangeValidator
public LongRangeValidator longRange(long minimum,
long maximum,
String message)
LongRangeValidator.
minimum - the minimum valuemaximum - the maximum valuemessage - the error message
LongRangeValidator
public DoubleRangeValidator doubleRange(double minimum,
double maximum)
DoubleRangeValidator. The key of error message is
"validator.range".
minimum - the minimum valuemaximum - the maximum value
DoubleRangeValidator
public DoubleRangeValidator doubleRange(double minimum,
double maximum,
String message)
DoubleRangeValidator.
minimum - the minimum valuemaximum - the maximum valuemessage - the error message
DoubleRangeValidator
public RegexpValidator regexp(String pattern)
throws NullPointerException
RegexpValidator. The key of error message is
"validator.regexp".
pattern - the pattern for regular expression
RegexpValidator
NullPointerException - if the pattern parameter is null
public RegexpValidator regexp(String pattern,
String message)
throws NullPointerException
RegexpValidator.
pattern - the pattern for regular expressionmessage - the error message
RegexpValidator
NullPointerException - if the pattern parameter is null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||