Reputation: 6163
How do you specify facets for the xsd in an annotated jaxb java class?
I'd like to limit a String to only 1 character using annotations (and not from an xsd). Is this possible?
Upvotes: 3
Views: 2414
Reputation: 149017
You can use an implementation of Bean Validation (JSR-303) for this use case. It allows you to specify validation rules via annotations or XML for object properties. Hibernate implemented the reference implementation:
Upvotes: 2