开发者

How do I specify a pattern constraint using JAXB annotations?

开发者 https://www.devze.com 2023-03-19 01:53 出处:网络
I\'m developing a SOAP application using JAX-WS and JAXB. I\'d like to specify a pattern constraint for one of the fields (a Dutch postcode, 开发者_开发百科\\d{4}[A-Z]{2}). That\'s very easy to do usi

I'm developing a SOAP application using JAX-WS and JAXB. I'd like to specify a pattern constraint for one of the fields (a Dutch postcode, 开发者_开发百科\d{4}[A-Z]{2}). That's very easy to do using xsd:pattern, but I can't find the equivalent JAXB annotation. How do I achieve this?


You can't. The idea is to use JAXB annotations in combination with runtime validation against the schema, using javax.xml.validation.Schema, which can be plugged into the Marshaller and Unmarshaller.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号