org.apache.commons.validator
クラス GenericTypeValidator

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

public class GenericTypeValidator
extends Object
implements Serializable

このクラスは妥当性チェックの際に行われる基本的なクラス型変換メソッドを持ちます。

バージョン:
$Revision: 1.1.1.1 $ $Date: 2004/02/13 10:02:01 $
作成者:
David Winterfeldt
関連項目:
直列化された形式
翻訳者:
日置 聡

コンストラクタの概要
GenericTypeValidator()
           
 
メソッドの概要
static Byte formatByte(String value)
          Checks if the value can safely be converted to a byte primitive.
static Long formatCreditCard(String value)
          Checks if the field is a valid credit card number.
static Date formatDate(String value, Locale locale)
          Checks if the field is a valid date.
static Date formatDate(String value, String datePattern, boolean strict)
          Checks if the field is a valid date.
static Double formatDouble(String value)
          Checks if the value can safely be converted to a double primitive.
static Float formatFloat(String value)
          Checks if the value can safely be converted to a float primitive.
static Integer formatInt(String value)
          Checks if the value can safely be converted to a int primitive.
static Long formatLong(String value)
          Checks if the value can safely be converted to a long primitive.
static Short formatShort(String value)
          Checks if the value can safely be converted to a short primitive.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

GenericTypeValidator

public GenericTypeValidator()
メソッドの詳細

formatByte

public static Byte formatByte(String value)

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

パラメータ:
value - The value validation is being performed on.

formatShort

public static Short formatShort(String value)

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

パラメータ:
value - The value validation is being performed on.

formatInt

public static Integer formatInt(String value)

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

パラメータ:
value - The value validation is being performed on.

formatLong

public static Long formatLong(String value)

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

パラメータ:
value - The value validation is being performed on.

formatFloat

public static Float formatFloat(String value)

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

パラメータ:
value - The value validation is being performed on.

formatDouble

public static Double formatDouble(String value)

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

パラメータ:
value - The value validation is being performed on.

formatDate

public static Date formatDate(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.

パラメータ:
value - The value validation is being performed on.
locale - The Locale to use to parse the date (system default if null)

formatDate

public static Date formatDate(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.

パラメータ:
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.

formatCreditCard

public static Long formatCreditCard(String value)

Checks if the field is a valid credit card number.

Translated to Java by Ted Husted (husted@apache.org).
    Reference Sean M. Burke's script at http://www.ling.nwu.edu/~sburke/pub/luhn_lib.pl

パラメータ:
value - The value validation is being performed on.


このドキュメントは、Ja-Jakartaにより訳されました。 コメントがある場合は report@jajakarta.orgまでお願いします。
Translated into Japanese by jajakarta.org. The original page is here.
Copyright (c) 2002-2003 - Apache Software Foundation