A simple but powerful library for validations in Java.
String something = "hello";
Bouncer.makeSure("Attribute", something)
.isNotBlank()
.isNotLongerThan(10)
.isNotShorterThan(5)
... many more.
class Employee {
@StringLengthRange(minLength = 4)
@NotNull
String id;
@StringLengthRange(minLength = 4, maxLength = 64)
@NotNull
String name;
@StringAnyOf(values = {"IT", "HR", "SALES"})
@NotNull
String department;
@StringValidUrl
String profileUrl;
}
And the validation:
Employee emp = something.
Bouncer.validate(emp);