user237673
user237673

Reputation:

specify minOccurence and maxOccurence with jaxb annotations

How do I specify minOccurence and maxOccurence for the collection(list) in .java file with jaxb annotations?

Upvotes: 4

Views: 401

Answers (1)

skaffman
skaffman

Reputation: 403441

You can't. JAXB annotations have only a very minimal set of validation abilities.

If you need to perform validation at runtime, you need to use an XML Schema for this. If you need to generate an XML Schema from Java, then you need to alter it after you generate it, to add the various bits of tight validation that you need.

Upvotes: 4

Related Questions