Java – annotation based validation framework

I am looking for an annotation - based validation framework that will allow me to validate parameter values Similar to the following:

void someMethod(@NotBlank String foo,@NotEmpty Collection bar,@Positive Integer baz,@NotNull Object obj) {

}

Whenever an annotated method / constructor is called, parameter validation is automatically performed so that validation cannot be bypassed

It would be nice if I could customize the error messages that appear I use Java 1.5

Solution

Try to see the implementers of jsr-303 (also known as bean validation) such as oval

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>