com.elasticpath.commons.validator.impl
Class EpFieldChecks

java.lang.Object
  extended by org.springmodules.commons.validator.FieldChecks
      extended by com.elasticpath.commons.validator.impl.EpFieldChecks
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
EpSfFieldChecks

public class EpFieldChecks
extends org.springmodules.commons.validator.FieldChecks

EpFieldChecks defines customized validation rules to be integrated into the springmodules validator.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.springmodules.commons.validator.FieldChecks
FIELD_TEST_EQUAL, FIELD_TEST_NOTNULL, FIELD_TEST_NULL
 
Constructor Summary
EpFieldChecks()
          Constructor.
 
Method Summary
static boolean validateCondition(java.lang.Object bean, org.apache.commons.validator.ValidatorAction validatorAction, org.apache.commons.validator.Field field, org.springframework.validation.Errors errors)
          Validate the field based on the specified conditions.
static boolean validateEmail(java.lang.Object bean, org.apache.commons.validator.ValidatorAction validatorAction, org.apache.commons.validator.Field field, org.springframework.validation.Errors errors)
          Email Validation used by EpEmail validator.
static boolean validateEpCartQuantity(java.lang.Object bean, org.apache.commons.validator.ValidatorAction validatorAction, org.apache.commons.validator.Field field, org.springframework.validation.Errors errors)
          Validate an integer used to specify a quantity.
static boolean validateNoLeadingTrailingWhiteSpaces(java.lang.Object bean, org.apache.commons.validator.ValidatorAction validatorAction, org.apache.commons.validator.Field field, org.springframework.validation.Errors errors)
          Validate that the field does not start and/or end whitespaces.
static boolean validatePasswordRequired(java.lang.Object bean, org.apache.commons.validator.ValidatorAction validatorAction, org.apache.commons.validator.Field field, org.springframework.validation.Errors errors)
          Clear-text password should be required if encryptedPassword is not null or empty.
static boolean validatePhoneNumber(java.lang.Object bean, org.apache.commons.validator.ValidatorAction validatorAction, org.apache.commons.validator.Field field, org.springframework.validation.Errors errors)
          Validate a phone number.
static boolean validateRequiredWhen(java.lang.Object bean, org.apache.commons.validator.ValidatorAction validatorAction, org.apache.commons.validator.Field field, org.springframework.validation.Errors errors)
          Validate a not null field, based on the specified condition.
static boolean validateSubCountryRequired(java.lang.Object bean, org.apache.commons.validator.ValidatorAction validatorAction, org.apache.commons.validator.Field field, org.springframework.validation.Errors errors)
          Validate whether the subCountry is required.
static boolean validateTwoFields(java.lang.Object bean, org.apache.commons.validator.ValidatorAction validatorAction, org.apache.commons.validator.Field field, org.springframework.validation.Errors errors)
          Validate if the two fields are same.
 
Methods inherited from class org.springmodules.commons.validator.FieldChecks
validateByte, validateCreditCard, validateDate, validateDouble, validateDoubleRange, validateFloat, validateFloatRange, validateInteger, validateIntRange, validateLong, validateMask, validateMaxLength, validateMinLength, validateRange, validateRequired, validateRequiredIf, validateShort
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EpFieldChecks

public EpFieldChecks()
Constructor.

Method Detail

validateCondition

public static boolean validateCondition(java.lang.Object bean,
                                        org.apache.commons.validator.ValidatorAction validatorAction,
                                        org.apache.commons.validator.Field field,
                                        org.springframework.validation.Errors errors)
Validate the field based on the specified conditions.

Parameters:
bean - - the current form bean (command object).
validatorAction - - validator action instance.
field - - the form field to check.
errors - - errors.
Returns:
- result.

validateEmail

public static boolean validateEmail(java.lang.Object bean,
                                    org.apache.commons.validator.ValidatorAction validatorAction,
                                    org.apache.commons.validator.Field field,
                                    org.springframework.validation.Errors errors)
Email Validation used by EpEmail validator.

Parameters:
bean - - the current form bean (command object).
validatorAction - - validator action instance.
field - - the form field to check.
errors - - errors.
Returns:
- result.

validateEpCartQuantity

public static boolean validateEpCartQuantity(java.lang.Object bean,
                                             org.apache.commons.validator.ValidatorAction validatorAction,
                                             org.apache.commons.validator.Field field,
                                             org.springframework.validation.Errors errors)
Validate an integer used to specify a quantity.

Parameters:
bean - - the current form bean (command object).
validatorAction - - validator action instance.
field - - the form field to check.
errors - - errors.
Returns:
- result.

validateNoLeadingTrailingWhiteSpaces

public static boolean validateNoLeadingTrailingWhiteSpaces(java.lang.Object bean,
                                                           org.apache.commons.validator.ValidatorAction validatorAction,
                                                           org.apache.commons.validator.Field field,
                                                           org.springframework.validation.Errors errors)
Validate that the field does not start and/or end whitespaces.

Parameters:
bean - - the current form bean (command object).
validatorAction - - validator action instance.
field - - the form field to check.
errors - - errors.
Returns:
- result.

validatePasswordRequired

public static boolean validatePasswordRequired(java.lang.Object bean,
                                               org.apache.commons.validator.ValidatorAction validatorAction,
                                               org.apache.commons.validator.Field field,
                                               org.springframework.validation.Errors errors)
Clear-text password should be required if encryptedPassword is not null or empty.

Parameters:
bean - - the current form bean (command object).
validatorAction - - validator action instance.
field - - the form field to check.
errors - - errors.
Returns:
- result.

validatePhoneNumber

public static boolean validatePhoneNumber(java.lang.Object bean,
                                          org.apache.commons.validator.ValidatorAction validatorAction,
                                          org.apache.commons.validator.Field field,
                                          org.springframework.validation.Errors errors)
Validate a phone number.

Parameters:
bean - - the current form bean (command object).
validatorAction - - validator action instance.
field - - the form field to check.
errors - - errors.
Returns:
- result.

validateRequiredWhen

public static boolean validateRequiredWhen(java.lang.Object bean,
                                           org.apache.commons.validator.ValidatorAction validatorAction,
                                           org.apache.commons.validator.Field field,
                                           org.springframework.validation.Errors errors)
Validate a not null field, based on the specified condition.

Parameters:
bean - - the current form bean (command object).
validatorAction - - validator action instance.
field - - the form field to check.
errors - - errors.
Returns:
- result.

validateSubCountryRequired

public static boolean validateSubCountryRequired(java.lang.Object bean,
                                                 org.apache.commons.validator.ValidatorAction validatorAction,
                                                 org.apache.commons.validator.Field field,
                                                 org.springframework.validation.Errors errors)
Validate whether the subCountry is required.

Parameters:
bean - - the current form bean (command object).
validatorAction - - validator action instance.
field - - the form field to check.
errors - - errors.
Returns:
- result.

validateTwoFields

public static boolean validateTwoFields(java.lang.Object bean,
                                        org.apache.commons.validator.ValidatorAction validatorAction,
                                        org.apache.commons.validator.Field field,
                                        org.springframework.validation.Errors errors)
Validate if the two fields are same.

Parameters:
bean - - the current form bean (command object).
validatorAction - - validator action instance.
field - - the form field to check.
errors - - errors.
Returns:
- result.