public class ValidateDate extends Object implements IValidator
SimpleDateFormat
. If the field has a datePatternStrict variable, that will be used to format
SimpleDateFormat
and the length will be checked so '2/12/1999' will not pass validation with the format
'MM/dd/yyyy' because the month isn't two digits. If no datePattern variable is specified, then the field gets the
DateFormat.SHORT format for the locale. The setLenient method is set to false
for all variations.org.apache.struts.validator.FieldChecks#validateDate(Object, org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages,
org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest)
コンストラクタと説明 |
---|
ValidateDate() |
修飾子とタイプ | メソッドと説明 |
---|---|
boolean |
validate(Annotation anno,
String targetValue,
Object lineObject)
Checks if the field is a valid date.
|
public boolean validate(Annotation anno, String targetValue, Object lineObject)
SimpleDateFormat
. If the field has a datePatternStrict variable, that will be used to format
SimpleDateFormat
and the length will be checked so '2/12/1999' will not pass validation with the format
'MM/dd/yyyy' because the month isn't two digits. If no datePattern variable is specified, then the field gets the
DateFormat.SHORT format for the locale. The setLenient method is set to false
for all variations.validate
インタフェース内 IValidator
anno
- バリデーションに対応するアノテーション.targetValue
- 検証値.lineObject
- Beanが所属するオブジェクト.true
:エラーなし.false
:エラーあり.#validate(java
.lang.annotation.Annotation, java.lang.String, java.lang.Object)