making / yavi

Yet Another Validation for Java (A lambda based type safe validation framework)
https://yavi.ik.am
Apache License 2.0
756 stars 62 forks source link

Introduce new type of builder to create an ArgumentValidator easily #367

Closed making closed 7 months ago

making commented 7 months ago
Arguments3Validator<String, String, Integer, Car> validator = Yavi.arguments()
    ._string("manufacturer", c -> c.notNull())
    ._string("licensePlate", c -> c.notNull().greaterThanOrEqual(2).lessThanOrEqual(14))
    ._integer("seatCount", c -> c.greaterThanOrEqual(2))
    .apply(Car::new);

Validated<Car> validated = validator.validate("foo", "bar", 3);

// or

Car car = validator.validated("foo", "bar", 3);