Example usage for org.apache.commons.validator Field getProperty

List of usage examples for org.apache.commons.validator Field getProperty

Introduction

In this page you can find the example usage for org.apache.commons.validator Field getProperty.

Prototype

public String getProperty() 

Source Link

Document

Gets the property name of the field.

Usage

From source file:org.megatome.frame2.validator.CommonsFieldValidator.java

/**
 * Validate that a required value is present.
 * /*ww  w.  j a  v  a2 s  .c o  m*/
 * @param bean
 *            The event containing the field to validate.
 * @param va
 *            The validator action
 * @param errors
 *            Errors object to populate
 * @param field
 *            The field to validate
 * @return True if the field contains a value.
 */
public static boolean validateRequired(Object bean, ValidatorAction va, Errors errors, Field field) {
    String value = ValidatorUtils.getValueAsString(bean, field.getProperty());
    return validateRequired(value, va, errors, field);
}

From source file:org.megatome.frame2.validator.CommonsFieldValidator.java

/**
 * Validate that a value matches a regular expression value.
 * /* ww  w .  j a va  2  s  . c o m*/
 * @param bean
 *            The event containing the field to validate.
 * @param va
 *            The validator action
 * @param errors
 *            Errors object to populate
 * @param field
 *            The field to validate
 * @return True if the field matches the regular expression.
 */
public static boolean mask(Object bean, ValidatorAction va, Errors errors, Field field) {
    String value = ValidatorUtils.getValueAsString(bean, field.getProperty());
    return mask(value, va, errors, field);
}

From source file:org.megatome.frame2.validator.CommonsFieldValidator.java

/**
 * Validate that a value can be converted to a byte value.
 * //from  w  ww .  j  av a  2 s  . c  om
 * @param bean
 *            The event containing the field to validate
 * @param va
 *            The validator action
 * @param errors
 *            Errors object to populate
 * @param field
 *            The field to validate
 * @return The Byte value of the field, or null if it could not be
 *         converted.
 */
public static Byte validateByte(Object bean, ValidatorAction va, Errors errors, Field field) {
    String value = ValidatorUtils.getValueAsString(bean, field.getProperty());
    return validateByte(value, va, errors, field);
}

From source file:org.megatome.frame2.validator.CommonsFieldValidator.java

/**
 * Validate that a value can be converted to a short value.
 * /*w  w w  .jav  a2 s  .  c o m*/
 * @param bean
 *            The event containing the field to validate
 * @param va
 *            The validator action
 * @param errors
 *            Errors object to populate
 * @param field
 *            The field to validate
 * @return The Short value of the field, or null if it could not be
 *         converted.
 */
public static Short validateShort(Object bean, ValidatorAction va, Errors errors, Field field) {
    String value = ValidatorUtils.getValueAsString(bean, field.getProperty());
    return validateShort(value, va, errors, field);
}

From source file:org.megatome.frame2.validator.CommonsFieldValidator.java

/**
 * Validate that a value can be converted to an integer value.
 * //from   ww  w.  jav a 2s. c  om
 * @param bean
 *            The event containing the field to validate
 * @param va
 *            The validator action
 * @param errors
 *            Errors object to populate
 * @param field
 *            The field to validate
 * @return The Integer value of the field, or null if it could not be
 *         converted.
 */
public static Integer validateInteger(Object bean, ValidatorAction va, Errors errors, Field field) {
    String value = ValidatorUtils.getValueAsString(bean, field.getProperty());
    return validateInteger(value, va, errors, field);
}

From source file:org.megatome.frame2.validator.CommonsFieldValidator.java

/**
 * Validate that a value can be converted to a long value.
 * //  w w  w  .  ja v  a2s . c o m
 * @param bean
 *            The event containing the field to validate
 * @param va
 *            The validator action
 * @param errors
 *            Errors object to populate
 * @param field
 *            The field to validate
 * @return The Long value of the field, or null if it could not be
 *         converted.
 */
public static Long validateLong(Object bean, ValidatorAction va, Errors errors, Field field) {
    String value = ValidatorUtils.getValueAsString(bean, field.getProperty());
    return validateLong(value, va, errors, field);
}

From source file:org.megatome.frame2.validator.CommonsFieldValidator.java

/**
 * Validate that a value can be converted to a float value.
 * /*  w w  w.  j  ava  2  s.c  o  m*/
 * @param bean
 *            The event containing the field to validate
 * @param va
 *            The validator action
 * @param errors
 *            Errors object to populate
 * @param field
 *            The field to validate
 * @return The Float value of the field, or null if it could not be
 *         converted.
 */
public static Float validateFloat(Object bean, ValidatorAction va, Errors errors, Field field) {
    String value = ValidatorUtils.getValueAsString(bean, field.getProperty());
    return validateFloat(value, va, errors, field);
}

From source file:org.megatome.frame2.validator.CommonsFieldValidator.java

/**
 * Validate that a value can be converted to a double value.
 * //from   ww w. j  a va2  s.  co m
 * @param bean
 *            The event containing the field to validate
 * @param va
 *            The validator action
 * @param errors
 *            Errors object to populate
 * @param field
 *            The field to validate
 * @return The Double value of the field, or null if it could not be
 *         converted.
 */
public static Double validateDouble(Object bean, ValidatorAction va, Errors errors, Field field) {
    String value = ValidatorUtils.getValueAsString(bean, field.getProperty());
    return validateDouble(value, va, errors, field);
}

From source file:org.megatome.frame2.validator.CommonsFieldValidator.java

/**
 * Validate that a value can be converted to a date.
 * /* ww w . ja v  a2s  . c o  m*/
 * @param bean
 *            The event containing the field to validate
 * @param va
 *            The validator action
 * @param errors
 *            Errors object to populate
 * @param field
 *            The field to validate
 * @return The Date value of the field, or null if it could not be
 *         converted.
 */
public static Date validateDate(Object bean, ValidatorAction va, Errors errors, Field field) {
    String value = ValidatorUtils.getValueAsString(bean, field.getProperty());
    return validateDate(value, va, errors, field);
}

From source file:org.megatome.frame2.validator.CommonsFieldValidator.java

/**
 * Validate that a value falls within a specified integer range.
 * /*w w w  .j  ava2 s  .  com*/
 * @param bean
 *            The event containing the field to validate
 * @param va
 *            The validator action
 * @param errors
 *            Errors object to populate
 * @param field
 *            The field to validate
 * @return True if the value is an integer, and falls within the range
 *         specified in the rules file.
 */
public static boolean validateIntRange(Object bean, ValidatorAction va, Errors errors, Field field) {
    String value = ValidatorUtils.getValueAsString(bean, field.getProperty());
    return validateIntRange(value, va, errors, field);
}