Syboos Commons BeanUtils validators - ValidateType

2010/04/12 17:55Update
TAGS: BeanUtils | Validator | ValidateType | TypeValidator

ValidateType annotation and TypeValidator class.

■ValidateType Annotation
◇ Class Name: com.syboos.beanutils.annotation.ValidateType
◇ Validator Class: com.syboos.beanutils.validator.TypeValidator
◇ Properties:
  1. message [optional] error message or error message key.
  2. when    [optional] timing or a condition for validation.
  3. type    java.lang.Class

◇ Usage:
By annotation
    @ValidateType(type=com.test.MyClass.class)
    private Object value;

    public Object getValue() {
        return value;
    }
    public void setValue(Object value) {
        this.value = value;
    }


    @ValidateType(when="login", message="Wrong type of value.", type=com.test.MyClass.class)
    private Object value;

    ...

.

有关作者
Syboos.jp編集長システム設計や開発、保守運営などを行ってます。オープンソース技術に興味があります。

Sponsored Link


Comments

用户名 (required)

Email (will not be published) (required)

URL

Evaluation