Does JAXB support xsd:restriction?

前端 未结 3 1087
我在风中等你
我在风中等你 2020-11-28 09:11

  
    
      
      

        
3条回答
  •  悲哀的现实
    2020-11-28 09:54

    The JAXB (JSR-222) specification does not cover generating fail fast logic into the domain model. A common practice now is to express validation rules in the form of annotations (or XML) and run validation on them. Bean Validation (JSR-303) standardizes this and is available in any Java EE 6 implementation.

    XJC Extensions

    I have not tried the following extension myself but it appears as though it will generate Bean Validation (JSR-303) annotations onto the domain model representation validation rules from the XML schema. As XJC is very extensible there may be other plug-ins available as well.

    • https://github.com/krasa/krasa-jaxb-tools

提交回复
热议问题