org.biojava.bio.seq.io.filterxml
Class XMLFilterWriter

java.lang.Object
  extended by org.biojava.bio.seq.io.filterxml.XMLFilterWriter

public class XMLFilterWriter
extends Object

Write FeatureFilters in XML format.

Since:
1.3
Author:
Thomas Down

Nested Class Summary
static interface XMLFilterWriter.FilterWriter
          Interface for an object which can write a FeatureFilter as XML.
 
Field Summary
static String XML_FILTER_NS
           
 
Constructor Summary
XMLFilterWriter()
          Construct a new XMLFilterWriter which can serialize the buildin types of FeatureFilter.
 
Method Summary
 void addXMLFilterWriter(Class clazz, XMLFilterWriter.FilterWriter xfw)
          Add a writer for the specified class of filters
 void addXMLFilterWriter(FeatureFilter ff, XMLFilterWriter.FilterWriter xfw)
          Add a writer for a singleton filter.
 boolean isStrict()
          Determine if this writer is in strict mode.
 void setIsStrict(boolean b)
          Selects strict mode.
 void writeFilter(FeatureFilter ff, XMLWriter xw)
          Write a FeatureFilter to the supplied XMLWriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_FILTER_NS

public static final String XML_FILTER_NS
See Also:
Constant Field Values
Constructor Detail

XMLFilterWriter

public XMLFilterWriter()
Construct a new XMLFilterWriter which can serialize the buildin types of FeatureFilter.

Method Detail

addXMLFilterWriter

public void addXMLFilterWriter(Class clazz,
                               XMLFilterWriter.FilterWriter xfw)
Add a writer for the specified class of filters


addXMLFilterWriter

public void addXMLFilterWriter(FeatureFilter ff,
                               XMLFilterWriter.FilterWriter xfw)
Add a writer for a singleton filter.


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 FeatureFilter it doesn't recognize. When not in strict model, unrecognized filters are silently replaced by FeatureFilter.all. Default is false.


writeFilter

public void writeFilter(FeatureFilter ff,
                        XMLWriter xw)
                 throws IllegalArgumentException,
                        IOException
Write a FeatureFilter to the supplied XMLWriter

Throws:
IllegalArgumentException - if the FeatureFilter is unrecognized, and the writer is in strict mode.
IOException - if an error occurs while outputting XML.