MOXy BeanValidation gives me the ability to add validation to my JAXB classes.
Using MOXy\'s \"Bean Validation Plugin\" I can have Bean Validation in generated JAX
You could also look to xjc plugin https://github.com/krasa/krasa-jaxb-tools
By documentation it support XJsr303Annotations and can generate:
@Valid annotation for all complex types, can be further restricted to generate only for types from defined schema: -XJsr303Annotations:targetNamespace=http://www.foo.com/bar@NotNull annotation for objects that has a MinOccur value >= 1 or for attributes with required use@Size for lists that have minOccurs > 1@Size if there is a maxLength or minLength or length restriction@DecimalMax for maxInclusive restriction@DecimalMin for minInclusive restriction@DecimalMax for maxExclusive restriction, enable new parameter (inclusive=false) with: -XJsr303Annotations:JSR_349=true@DecimalMin for minExclusive restriction, enable new parameter (inclusive=false) with: -XJsr303Annotations:JSR_349=true@Digits if there is a totalDigits or fractionDigits restriction.@Pattern if there is a Pattern restrictionIf you wonder how to use XJC plugins in your build environment (ant, maven, gradle) I may recomment look at examples of another plugin: immutable-xjc
So I hope it helps.