Using JSR 303 is it possible to generate validation.xml from annotations?

Posted by HappyEngineer on Stack Overflow See other posts from Stack Overflow or by HappyEngineer
Published on 2010-01-18T23:40:04Z Indexed on 2010/05/11 15:34 UTC
Read the original article Hit count: 298

Filed under:
|

Let's say I have an annotation JSR 303 class like this:

class A {
    @NotNull
    private String b;

    @Min(5)
    @Max(10)
    private int num = 3;

    @Pattern(regexp="[0-9]*")
    private String foo = "12345aa";
}

How can I take that class and generate a validation.xml which contains the same constraints as those that are specified by the annotations?

© Stack Overflow or respective owner

Related posts about jsr303

Related posts about Xml