|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.apache.commons.validator.GenericTypeValidator
This class contains basic methods for performing validations that return the correctly typed class based on the validation performed.
| Constructor Summary | |
GenericTypeValidator()
|
|
| Method Summary | |
static java.lang.Byte |
formatByte(java.lang.String value)
Checks if the value can safely be converted to a byte primitive. |
static java.lang.Byte |
formatByte(java.lang.String value,
java.util.Locale locale)
Checks if the value can safely be converted to a byte primitive. |
static java.lang.Long |
formatCreditCard(java.lang.String value)
Checks if the field is a valid credit card number. |
static java.util.Date |
formatDate(java.lang.String value,
java.util.Locale locale)
Checks if the field is a valid date. |
static java.util.Date |
formatDate(java.lang.String value,
java.lang.String datePattern,
boolean strict)
Checks if the field is a valid date. |
static java.lang.Double |
formatDouble(java.lang.String value)
Checks if the value can safely be converted to a double primitive. |
static java.lang.Double |
formatDouble(java.lang.String value,
java.util.Locale locale)
Checks if the value can safely be converted to a double primitive. |
static java.lang.Float |
formatFloat(java.lang.String value)
Checks if the value can safely be converted to a float primitive. |
static java.lang.Float |
formatFloat(java.lang.String value,
java.util.Locale locale)
Checks if the value can safely be converted to a float primitive. |
static java.lang.Integer |
formatInt(java.lang.String value)
Checks if the value can safely be converted to a int primitive. |
static java.lang.Integer |
formatInt(java.lang.String value,
java.util.Locale locale)
Checks if the value can safely be converted to an int primitive. |
static java.lang.Long |
formatLong(java.lang.String value)
Checks if the value can safely be converted to a long primitive. |
static java.lang.Long |
formatLong(java.lang.String value,
java.util.Locale locale)
Checks if the value can safely be converted to a long primitive. |
static java.lang.Short |
formatShort(java.lang.String value)
Checks if the value can safely be converted to a short primitive. |
static java.lang.Short |
formatShort(java.lang.String value,
java.util.Locale locale)
Checks if the value can safely be converted to a short primitive. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public GenericTypeValidator()
| Method Detail |
public static java.lang.Byte formatByte(java.lang.String value)
value - The value validation is being performed on.
public static java.lang.Byte formatByte(java.lang.String value,
java.util.Locale locale)
value - The value validation is being performed on.locale - The locale to use to parse the number (system default if
null)public static java.lang.Short formatShort(java.lang.String value)
value - The value validation is being performed on.
public static java.lang.Short formatShort(java.lang.String value,
java.util.Locale locale)
value - The value validation is being performed on.locale - The locale to use to parse the number (system default if
null)vvpublic static java.lang.Integer formatInt(java.lang.String value)
value - The value validation is being performed on.
public static java.lang.Integer formatInt(java.lang.String value,
java.util.Locale locale)
value - The value validation is being performed on.locale - The locale to use to parse the number (system default if
null)public static java.lang.Long formatLong(java.lang.String value)
value - The value validation is being performed on.
public static java.lang.Long formatLong(java.lang.String value,
java.util.Locale locale)
value - The value validation is being performed on.locale - The locale to use to parse the number (system default if
null)public static java.lang.Float formatFloat(java.lang.String value)
value - The value validation is being performed on.
public static java.lang.Float formatFloat(java.lang.String value,
java.util.Locale locale)
value - The value validation is being performed on.locale - The locale to use to parse the number (system default if
null)public static java.lang.Double formatDouble(java.lang.String value)
value - The value validation is being performed on.
public static java.lang.Double formatDouble(java.lang.String value,
java.util.Locale locale)
value - The value validation is being performed on.locale - The locale to use to parse the number (system default if
null)
public static java.util.Date formatDate(java.lang.String value,
java.util.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.
value - The value validation is being performed on.locale - The Locale to use to parse the date (system default if
null)
public static java.util.Date formatDate(java.lang.String value,
java.lang.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.
value - The value validation is being performed on.datePattern - The pattern passed to SimpleDateFormat.strict - Whether or not to have an exact match of the
datePattern.public static java.lang.Long formatCreditCard(java.lang.String value)
Checks if the field is a valid credit card number.
Reference Sean M. Burke's script .
value - The value validation is being performed on.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||