Package org.biojava.bio.seq.io.filterxml
Class XMLAnnotationTypeWriter
- java.lang.Object
-
- org.biojava.bio.seq.io.filterxml.XMLAnnotationTypeWriter
-
public class XMLAnnotationTypeWriter extends 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceXMLAnnotationTypeWriter.XMLCollectionConstraintWriterWriter for types of CollectionConstraint.static interfaceXMLAnnotationTypeWriter.XMLPropertyConstraintWriterWriter for types of PropertyConstraint.
-
Field Summary
Fields Modifier and Type Field Description static StringXML_ANNOTATIONTYPE_NSXML namespace string used to the AnnotationType representation
-
Constructor Summary
Constructors Constructor Description XMLAnnotationTypeWriter()Construct a new AnnotationTypeWriter which knows about the builtin types of PropertyConstraint
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddXMLCollectionConstraintWriter(Class clazz, XMLAnnotationTypeWriter.XMLCollectionConstraintWriter xfw)Register a writer for the specified class of collection constraintvoidaddXMLCollectionConstraintWriter(CollectionConstraint pc, XMLAnnotationTypeWriter.XMLCollectionConstraintWriter xfw)Register a writer for a singleton property constraint.voidaddXMLPropertyConstraintWriter(Class clazz, XMLAnnotationTypeWriter.XMLPropertyConstraintWriter xfw)Register a writer for the specified class of property constraintvoidaddXMLPropertyConstraintWriter(PropertyConstraint pc, XMLAnnotationTypeWriter.XMLPropertyConstraintWriter xfw)Register a writer for a singleton property constraint.booleanisStrict()Determine if this writer is in strict mode.voidsetIsStrict(boolean b)Selects strict mode.voidwriteAnnotationType(AnnotationType at, XMLWriter xw)Write anAnnotationTypeto the specified XMLWriter.
-
-
-
Field Detail
-
XML_ANNOTATIONTYPE_NS
public static final 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
-
addXMLPropertyConstraintWriter
public void addXMLPropertyConstraintWriter(Class clazz, XMLAnnotationTypeWriter.XMLPropertyConstraintWriter xfw)
Register a writer for the specified class of property constraint
-
addXMLPropertyConstraintWriter
public void addXMLPropertyConstraintWriter(PropertyConstraint pc, XMLAnnotationTypeWriter.XMLPropertyConstraintWriter xfw)
Register a writer for a singleton property constraint.
-
addXMLCollectionConstraintWriter
public void addXMLCollectionConstraintWriter(Class clazz, XMLAnnotationTypeWriter.XMLCollectionConstraintWriter xfw)
Register a writer for the specified class of collection constraint
-
addXMLCollectionConstraintWriter
public void addXMLCollectionConstraintWriter(CollectionConstraint pc, XMLAnnotationTypeWriter.XMLCollectionConstraintWriter xfw)
Register a writer for a singleton property constraint.
-
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 anIllegalArgumentExceptionif it encounters a type ofPropertyConstraintit doesn't recognize. When not in strict model, unrecognized constraints are silently replaced byPropertyConstraint.ANY. Default isfalse.
-
writeAnnotationType
public void writeAnnotationType(AnnotationType at, XMLWriter xw) throws IllegalArgumentException, IOException
Write anAnnotationTypeto the specified XMLWriter.- Throws:
IllegalArgumentException- if the AnnotationType contains unrecognized constraints, and the writer is in strict mode.IOException- if an error occurs while outputting XML.
-
-