O - the type of Java object this translator instance is able to handlepublic interface ObjectTranslator<O>
 Instances of implementations can be obtained using ObjectTranslatorFactory, which also allows to register
 custom implementations (e.g. provided in application code). Instances of JPhyloIOEventReader and 
 JPhyloIOEventWriter make use of object translators to read and write literal metadata objects. The factory
 to be used can be specified using the parameter ReadWriteParameterNames.KEY_OBJECT_TRANSLATOR_FACTORY.
ObjectTranslatorFactory, 
ReadWriteParameterNames.KEY_OBJECT_TRANSLATOR_FACTORY| Modifier and Type | Method and Description | 
|---|---|
| java.lang.Class<O> | getObjectClass()Returns the Java class of object instances created by this translator. | 
| boolean | hasStringRepresentation()Determines whether the objects handled by this instance have a simple string representation or need a more complex
 XML representation. | 
| java.lang.String | javaToRepresentation(java.lang.Object object,
                    WriterStreamDataProvider<?> streamDataProvider)Converts the specified Java object to its string representation. | 
| O | readXMLRepresentation(javax.xml.stream.XMLEventReader reader,
                     ReaderStreamDataProvider<?> streamDataProvider)Tries to create a new instance of the handled object type from the data provided by the specified XML reader. | 
| O | representationToJava(java.lang.String representation,
                    ReaderStreamDataProvider<?> streamDataProvider)Converts the specified string representation to a new instance of the according Java object. | 
| void | writeXMLRepresentation(javax.xml.stream.XMLStreamWriter writer,
                      java.lang.Object object,
                      WriterStreamDataProvider<?> streamDataProvider)Writes the XML representation of the specified object into the specified XML writer. | 
java.lang.Class<O> getObjectClass()
 Note that javaToRepresentation(Object, WriterStreamDataProvider) and writeXMLRepresentation(XMLStreamWriter, Object, WriterStreamDataProvider) may also 
 accept instances of other classes. This is independent from the return value here.
boolean hasStringRepresentation()
 Instances that return false here will throw an UnsupportedOperationException, if 
 javaToRepresentation(Object, WriterStreamDataProvider) is called.
true if handled objects have a simple string representation or false if XML is necessary to
         represent the handled objectsjava.lang.String javaToRepresentation(java.lang.Object object, WriterStreamDataProvider<?> streamDataProvider) throws java.lang.UnsupportedOperationException, java.lang.ClassCastException
object - the object to be translatedstreamDataProvider - TODOjava.lang.UnsupportedOperationException - if objects handled by this instance can only be represented as XMLjava.lang.ClassCastException - if the specified object is not an instance of the supported class or does not implement the supported
         interfacehasStringRepresentation()void writeXMLRepresentation(javax.xml.stream.XMLStreamWriter writer, java.lang.Object object, WriterStreamDataProvider<?> streamDataProvider) throws java.io.IOException, javax.xml.stream.XMLStreamException, java.lang.ClassCastException
writer - the writer to be used to write the XML representationobject - the object to be convertedstreamDataProvider - TODOjava.io.IOException - if an I/O error occurs while trying to write to the specified writerjavax.xml.stream.XMLStreamException - if an XML stream exception occurs while trying to write to the specified writerjava.lang.ClassCastExceptionO representationToJava(java.lang.String representation, ReaderStreamDataProvider<?> streamDataProvider) throws InvalidObjectSourceDataException, java.lang.UnsupportedOperationException
 If #getClass() returns an interface for this instance, the concrete class of the returned object may 
 depend on the representation.
representation - the string representation of the object to be createdstreamDataProvider - the stream data provider of the calling reader (Maybe null. Some translators will use it to gain 
        additional status information required for translating, e.g. prefix to namespace mapping for creating QNames.)java.lang.UnsupportedOperationException - if objects handled by this instance can only be represented as XMLInvalidObjectSourceDataException - if the specified string representation cannot be parsed to a supported objectO readXMLRepresentation(javax.xml.stream.XMLEventReader reader, ReaderStreamDataProvider<?> streamDataProvider) throws java.io.IOException, javax.xml.stream.XMLStreamException, InvalidObjectSourceDataException
This method will start reading from the current position of the reader and read only as far as necessary to collect all data for the new object. Therefore the reader should be positioned before the start tag, that represents the object and will read until the according end tag was consumed. If the supported objects have a simple string representation, the reader should be positioned in front of the according characters.
If this
reader - the XML reader providing the data to create a new objectstreamDataProvider - TODOjava.io.IOException - if an I/O error occurs while trying to read from the specified readerjavax.xml.stream.XMLStreamException - if an XML stream exception occurs while trying to read from the specified readerInvalidObjectSourceDataException - if an unexpected XML event was encountered or an XML event has unexpected contents