3
标题可能说了一切,我想知道是否可以告诉cxf-codegen插件添加例如xsd-patterns作为@Pattern
注释。模式验证很好,所有的,但有时我只想检查一个单一的元素,而不是无数的XML线。有没有办法将JSR303注释添加到cxf生成的类中?
为此我在想,如果有一个小窍门/选项/肮脏的黑客那里,这将有助于我打开
<xs:simpleType name="string2000">
<xs:restriction base="xs:string">
<xs:maxLength value="2000"/>
<xs:minLength value="1"/>
<xs:pattern value="[\p{IsBasicLatin}\p{IsLatin-1Supplement}-[ \t\r\n]][\p{IsBasicLatin}\p{IsLatin-1Supplement}-[\t\r\n]]*"/>
</xs:restriction>
</xs:simpleType>
到
@Pattern(regexp = "\\p{IsBasicLatin}\\p{IsLatin-1Supplement}-[ \\t\\r\\n]][\\p{IsBasicLatin}\\p{IsLatin-1Supplement}-[\\t\\r\\n]]*")
@Size(min = 1, max = 2000)
因为手动添加它是一个不走这个量的XML,它会让事情变得更容易。
对不起,这花了这么长时间,其他的事情出现了,我会看看它:) – Scorpio