Home

Marek Tuchowski

Usage

Import package

import pl.com.tuchowski.validity.*;

Annotate class

class Cow {
    public Cow(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Validate
    @StringLength(max=30)
    private String name;

    @Validate
    @IntegerRange(min=0, max=10)
    private int age;
}

Compile validator

Validator v = ValidatorFactory.getInstance().getValidator(Cow.class);

Validate object

Cow cow = new Cow("Alpengold", 3);
v.validate(cow);

Other

Created by

Project Admins: