Syboos Commons BeanUtils validators - ValidateIn

2010/04/12 17:06Update
TAGS: BeanUtils | Validator | ValidateIn | InValidator

ValidateIn annotation and InValidator class.

■ValidateIn Annotation
◇ Class Name: com.syboos.beanutils.annotation.ValidateIn
◇ Validator Class: com.syboos.beanutils.validator.InValidator
◇ Properties:
  1. value   String [].
  2. message [optional] error message or error message key.
  3. when    [optional] timing or a condition for validation.

◇ Usage:
By annotation
    @ValidateIn({"a", "b", "c"})
    private String name;

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }


    @ValidateIn(when="login", message="value must be 'a', 'b' or 'c'", value="{"a", "b", "c"}")
    private String name;


By XML
<field  name="name">
    <validator class="com.syboos.beanutils.validator.InValidator" message="value must be 'a', 'b' or 'c'" />
</field>

.

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

Sponsored Link


Comments

用户名 (required)

Email (will not be published) (required)

URL

Evaluation