Home » commons-validator-1.3.1-src » org.apache.commons » validator » [javadoc | source]
org.apache.commons.validator
public class: GenericValidator [javadoc | source]
java.lang.Object
   org.apache.commons.validator.GenericValidator

All Implemented Interfaces:
    Serializable

This class contains basic methods for performing validations.
Method from org.apache.commons.validator.GenericValidator Summary:
isBlankOrNull,   isByte,   isCreditCard,   isDate,   isDate,   isDouble,   isEmail,   isFloat,   isInRange,   isInRange,   isInRange,   isInRange,   isInRange,   isInRange,   isInt,   isLong,   isShort,   isUrl,   matchRegexp,   maxLength,   maxLength,   maxValue,   maxValue,   maxValue,   maxValue,   minLength,   minLength,   minValue,   minValue,   minValue,   minValue
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.commons.validator.GenericValidator Detail:
 public static boolean isBlankOrNull(String value) 

    Checks if the field isn't null and length of the field is greater than zero not including whitespace.

 public static boolean isByte(String value) 

    Checks if the value can safely be converted to a byte primitive.

 public static boolean isCreditCard(String value) 
    Checks if the field is a valid credit card number.
 public static boolean isDate(String value,
    Locale locale) 

    Checks if the field is a valid date. The Locale is used with java.text.DateFormat. The setLenient method is set to false for all.

 public static boolean isDate(String value,
    String datePattern,
    boolean strict) 

    Checks if the field is a valid date. The pattern is used with java.text.SimpleDateFormat. If strict is true, then 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. The setLenient method is set to false for all.

 public static boolean isDouble(String value) 

    Checks if the value can safely be converted to a double primitive.

 public static boolean isEmail(String value) 

    Checks if a field has a valid e-mail address.

 public static boolean isFloat(String value) 

    Checks if the value can safely be converted to a float primitive.

 public static boolean isInRange(byte value,
    byte min,
    byte max) 

    Checks if a value is within a range (min & max specified in the vars attribute).

 public static boolean isInRange(int value,
    int min,
    int max) 

    Checks if a value is within a range (min & max specified in the vars attribute).

 public static boolean isInRange(float value,
    float min,
    float max) 

    Checks if a value is within a range (min & max specified in the vars attribute).

 public static boolean isInRange(short value,
    short min,
    short max) 

    Checks if a value is within a range (min & max specified in the vars attribute).

 public static boolean isInRange(long value,
    long min,
    long max) 

    Checks if a value is within a range (min & max specified in the vars attribute).

 public static boolean isInRange(double value,
    double min,
    double max) 

    Checks if a value is within a range (min & max specified in the vars attribute).

 public static boolean isInt(String value) 

    Checks if the value can safely be converted to a int primitive.

 public static boolean isLong(String value) 

    Checks if the value can safely be converted to a long primitive.

 public static boolean isShort(String value) 

    Checks if the value can safely be converted to a short primitive.

 public static boolean isUrl(String value) 

    Checks if a field is a valid url address.

    If you need to modify what is considered valid then consider using the UrlValidator directly.
 public static boolean matchRegexp(String value,
    String regexp) 

    Checks if the value matches the regular expression.

 public static boolean maxLength(String value,
    int max) 

    Checks if the value's length is less than or equal to the max.

 public static boolean maxLength(String value,
    int max,
    int lineEndLength) 

    Checks if the value's adjusted length is less than or equal to the max.

 public static boolean maxValue(int value,
    int max) 

    Checks if the value is less than or equal to the max.

 public static boolean maxValue(long value,
    long max) 

    Checks if the value is less than or equal to the max.

 public static boolean maxValue(double value,
    double max) 

    Checks if the value is less than or equal to the max.

 public static boolean maxValue(float value,
    float max) 

    Checks if the value is less than or equal to the max.

 public static boolean minLength(String value,
    int min) 

    Checks if the value's length is greater than or equal to the min.

 public static boolean minLength(String value,
    int min,
    int lineEndLength) 

    Checks if the value's adjusted length is greater than or equal to the min.

 public static boolean minValue(int value,
    int min) 

    Checks if the value is greater than or equal to the min.

 public static boolean minValue(long value,
    long min) 

    Checks if the value is greater than or equal to the min.

 public static boolean minValue(double value,
    double min) 

    Checks if the value is greater than or equal to the min.

 public static boolean minValue(float value,
    float min) 

    Checks if the value is greater than or equal to the min.