Class XMLAnnotationTypeWriter


  • public class XMLAnnotationTypeWriter
    extends java.lang.Object
    Main class for writing AnnotationTypes as XML. Knows about all the builtin classes of AnnotationType. It's possible to plug new ones in by calling one of the addXMLPropertyConstraintWriter methods.
    Since:
    1.3
    Author:
    Thomas Down
    • Field Detail

      • XML_ANNOTATIONTYPE_NS

        public static final java.lang.String XML_ANNOTATIONTYPE_NS
        XML namespace string used to the AnnotationType representation
        See Also:
        Constant Field Values
    • Constructor Detail

      • XMLAnnotationTypeWriter

        public XMLAnnotationTypeWriter()
        Construct a new AnnotationTypeWriter which knows about the builtin types of PropertyConstraint
    • Method Detail

      • isStrict

        public boolean isStrict()
        Determine if this writer is in strict mode.
      • setIsStrict

        public void setIsStrict​(boolean b)
        Selects strict mode. In strict mode, the writer will throw an IllegalArgumentException if it encounters a type of PropertyConstraint it doesn't recognize. When not in strict model, unrecognized constraints are silently replaced by PropertyConstraint.ANY. Default is false.
      • writeAnnotationType

        public void writeAnnotationType​(AnnotationType at,
                                        XMLWriter xw)
                                 throws java.lang.IllegalArgumentException,
                                        java.io.IOException
        Write an AnnotationType to the specified XMLWriter.
        Throws:
        java.lang.IllegalArgumentException - if the AnnotationType contains unrecognized constraints, and the writer is in strict mode.
        java.io.IOException - if an error occurs while outputting XML.