org.apache.struts.validator
クラス FieldChecks

java.lang.Object
  拡張org.apache.struts.validator.FieldChecks
すべての実装インタフェース:
java.io.Serializable

public class FieldChecks
extends java.lang.Object
implements java.io.Serializable

This class contains the default validations that are used in the validator-rules.xml file.

In general passing in a null or blank will return a null Object or a false boolean. However, nulls and blanks do not result in an error being added to the errors.

導入されたバージョン:
Struts 1.1
関連項目:
直列化された形式

フィールドの概要
static java.lang.String FIELD_TEST_EQUAL
           
static java.lang.String FIELD_TEST_NOTNULL
           
static java.lang.String FIELD_TEST_NULL
           
private static org.apache.commons.logging.Log log
          Commons Logging instance.
 
コンストラクタの概要
FieldChecks()
           
 
メソッドの概要
protected static boolean isString(java.lang.Object o)
          Return true if the specified object is a String or a null value.
static java.lang.Object validateByte(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if the field can safely be converted to a byte primitive.
static java.lang.Object validateCreditCard(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if the field is a valid credit card number.
static java.lang.Object validateDate(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if the field is a valid date.
static java.lang.Object validateDouble(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if the field can safely be converted to a double primitive.
static boolean validateDoubleRange(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if a fields value is within a range (min & max specified in the vars attribute).
static boolean validateEmail(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if a field has a valid e-mail address.
static java.lang.Object validateFloat(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if the field can safely be converted to a float primitive.
static boolean validateFloatRange(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if a fields value is within a range (min & max specified in the vars attribute).
static java.lang.Object validateInteger(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if the field can safely be converted to an int primitive.
static boolean validateIntRange(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if a fields value is within a range (min & max specified in the vars attribute).
static java.lang.Object validateLong(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if the field can safely be converted to a long primitive.
static boolean validateMask(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if the field matches the regular expression in the field's mask attribute.
static boolean validateMaxLength(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if the field's length is less than or equal to the maximum value.
static boolean validateMinLength(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if the field's length is greater than or equal to the minimum value.
static boolean validateRequired(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if the field isn't null and length of the field is greater than zero not including whitespace.
static boolean validateRequiredIf(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, org.apache.commons.validator.Validator validator, javax.servlet.http.HttpServletRequest request)
          Checks if the field isn't null based on the values of other fields.
static java.lang.Object validateShort(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if the field can safely be converted to a short primitive.
static boolean validateUrl(java.lang.Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, ActionMessages errors, javax.servlet.http.HttpServletRequest request)
          Checks if a field has a valid url.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

log

private static final org.apache.commons.logging.Log log
Commons Logging instance.


FIELD_TEST_NULL

public static final java.lang.String FIELD_TEST_NULL
関連項目:
定数フィールド値

FIELD_TEST_NOTNULL

public static final java.lang.String FIELD_TEST_NOTNULL
関連項目:
定数フィールド値

FIELD_TEST_EQUAL

public static final java.lang.String FIELD_TEST_EQUAL
関連項目:
定数フィールド値
コンストラクタの詳細

FieldChecks

public FieldChecks()
メソッドの詳細

validateRequired

public static boolean validateRequired(java.lang.Object bean,
                                       org.apache.commons.validator.ValidatorAction va,
                                       org.apache.commons.validator.Field field,
                                       ActionMessages errors,
                                       javax.servlet.http.HttpServletRequest request)
Checks if the field isn't null and length of the field is greater than zero not including whitespace.

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
true if meets stated requirements, false otherwise.

validateRequiredIf

public static boolean validateRequiredIf(java.lang.Object bean,
                                         org.apache.commons.validator.ValidatorAction va,
                                         org.apache.commons.validator.Field field,
                                         ActionMessages errors,
                                         org.apache.commons.validator.Validator validator,
                                         javax.servlet.http.HttpServletRequest request)
Checks if the field isn't null based on the values of other fields.

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
validator - The Validator instance, used to access other field values.
request - Current request object.
戻り値:
true if meets stated requirements, false otherwise.

validateMask

public static boolean validateMask(java.lang.Object bean,
                                   org.apache.commons.validator.ValidatorAction va,
                                   org.apache.commons.validator.Field field,
                                   ActionMessages errors,
                                   javax.servlet.http.HttpServletRequest request)
Checks if the field matches the regular expression in the field's mask attribute.

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
true if field matches mask, false otherwise.

validateByte

public static java.lang.Object validateByte(java.lang.Object bean,
                                            org.apache.commons.validator.ValidatorAction va,
                                            org.apache.commons.validator.Field field,
                                            ActionMessages errors,
                                            javax.servlet.http.HttpServletRequest request)
Checks if the field can safely be converted to a byte primitive.

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
true if valid, false otherwise.

validateShort

public static java.lang.Object validateShort(java.lang.Object bean,
                                             org.apache.commons.validator.ValidatorAction va,
                                             org.apache.commons.validator.Field field,
                                             ActionMessages errors,
                                             javax.servlet.http.HttpServletRequest request)
Checks if the field can safely be converted to a short primitive.

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
true if valid, false otherwise.

validateInteger

public static java.lang.Object validateInteger(java.lang.Object bean,
                                               org.apache.commons.validator.ValidatorAction va,
                                               org.apache.commons.validator.Field field,
                                               ActionMessages errors,
                                               javax.servlet.http.HttpServletRequest request)
Checks if the field can safely be converted to an int primitive.

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
true if valid, false otherwise.

validateLong

public static java.lang.Object validateLong(java.lang.Object bean,
                                            org.apache.commons.validator.ValidatorAction va,
                                            org.apache.commons.validator.Field field,
                                            ActionMessages errors,
                                            javax.servlet.http.HttpServletRequest request)
Checks if the field can safely be converted to a long primitive.

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
true if valid, false otherwise.

validateFloat

public static java.lang.Object validateFloat(java.lang.Object bean,
                                             org.apache.commons.validator.ValidatorAction va,
                                             org.apache.commons.validator.Field field,
                                             ActionMessages errors,
                                             javax.servlet.http.HttpServletRequest request)
Checks if the field can safely be converted to a float primitive.

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
true if valid, false otherwise.

validateDouble

public static java.lang.Object validateDouble(java.lang.Object bean,
                                              org.apache.commons.validator.ValidatorAction va,
                                              org.apache.commons.validator.Field field,
                                              ActionMessages errors,
                                              javax.servlet.http.HttpServletRequest request)
Checks if the field can safely be converted to a double primitive.

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
true if valid, false otherwise.

validateDate

public static java.lang.Object validateDate(java.lang.Object bean,
                                            org.apache.commons.validator.ValidatorAction va,
                                            org.apache.commons.validator.Field field,
                                            ActionMessages errors,
                                            javax.servlet.http.HttpServletRequest request)
Checks if the field is a valid date. If the field has a datePattern variable, that will be used to format java.text.SimpleDateFormat. If the field has a datePatternStrict variable, that will be used to format java.text.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.

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
true if valid, false otherwise.

validateIntRange

public static boolean validateIntRange(java.lang.Object bean,
                                       org.apache.commons.validator.ValidatorAction va,
                                       org.apache.commons.validator.Field field,
                                       ActionMessages errors,
                                       javax.servlet.http.HttpServletRequest request)
Checks if a fields value is within a range (min & max specified in the vars attribute).

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
True if in range, false otherwise.

validateDoubleRange

public static boolean validateDoubleRange(java.lang.Object bean,
                                          org.apache.commons.validator.ValidatorAction va,
                                          org.apache.commons.validator.Field field,
                                          ActionMessages errors,
                                          javax.servlet.http.HttpServletRequest request)
Checks if a fields value is within a range (min & max specified in the vars attribute).

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
True if in range, false otherwise.

validateFloatRange

public static boolean validateFloatRange(java.lang.Object bean,
                                         org.apache.commons.validator.ValidatorAction va,
                                         org.apache.commons.validator.Field field,
                                         ActionMessages errors,
                                         javax.servlet.http.HttpServletRequest request)
Checks if a fields value is within a range (min & max specified in the vars attribute).

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
True if in range, false otherwise.

validateCreditCard

public static java.lang.Object validateCreditCard(java.lang.Object bean,
                                                  org.apache.commons.validator.ValidatorAction va,
                                                  org.apache.commons.validator.Field field,
                                                  ActionMessages errors,
                                                  javax.servlet.http.HttpServletRequest request)
Checks if the field is a valid credit card number.

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
true if valid, false otherwise.

validateEmail

public static boolean validateEmail(java.lang.Object bean,
                                    org.apache.commons.validator.ValidatorAction va,
                                    org.apache.commons.validator.Field field,
                                    ActionMessages errors,
                                    javax.servlet.http.HttpServletRequest request)
Checks if a field has a valid e-mail address.

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
True if valid, false otherwise.

validateMaxLength

public static boolean validateMaxLength(java.lang.Object bean,
                                        org.apache.commons.validator.ValidatorAction va,
                                        org.apache.commons.validator.Field field,
                                        ActionMessages errors,
                                        javax.servlet.http.HttpServletRequest request)
Checks if the field's length is less than or equal to the maximum value. A Null will be considered an error.

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
True if stated conditions met.

validateMinLength

public static boolean validateMinLength(java.lang.Object bean,
                                        org.apache.commons.validator.ValidatorAction va,
                                        org.apache.commons.validator.Field field,
                                        ActionMessages errors,
                                        javax.servlet.http.HttpServletRequest request)
Checks if the field's length is greater than or equal to the minimum value. A Null will be considered an error.

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
True if stated conditions met.

validateUrl

public static boolean validateUrl(java.lang.Object bean,
                                  org.apache.commons.validator.ValidatorAction va,
                                  org.apache.commons.validator.Field field,
                                  ActionMessages errors,
                                  javax.servlet.http.HttpServletRequest request)
Checks if a field has a valid url. Four optional variables can be specified to configure url validation.

パラメータ:
bean - The bean validation is being performed on.
va - The ValidatorAction that is currently being performed.
field - The Field object associated with the current field being validated.
errors - The ActionMessages object to add errors to if any validation errors occur.
request - Current request object.
戻り値:
True if valid, false otherwise.

isString

protected static boolean isString(java.lang.Object o)
Return true if the specified object is a String or a null value.

パラメータ:
o - Object to be tested
戻り値:
The string value


このドキュメントは、Ja-Jakartaにより訳されました。コメントがある場合は、report@jajakarta.orgまでお願いします。
Copyright (C) 2000-2004 - Apache Software Foundation