O
- the type of Java object this translator instance is able to handlepublic abstract class AbstractXMLObjectTranslator<O> extends AbstractObjectTranslator<O>
Constructor and Description |
---|
AbstractXMLObjectTranslator() |
Modifier and Type | Method and Description |
---|---|
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 |
representationToJava(java.lang.String representation,
ReaderStreamDataProvider<?> streamDataProvider)
Converts the specified string representation to a new instance of the according Java object.
|
equals, hashCode
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getObjectClass, readXMLRepresentation, writeXMLRepresentation
public AbstractXMLObjectTranslator()
public boolean hasStringRepresentation()
ObjectTranslator
Instances that return false here
will throw an UnsupportedOperationException
, if
ObjectTranslator.javaToRepresentation(Object, WriterStreamDataProvider)
is called.
true
if handled objects have a simple string representation or false
if XML is necessary to
represent the handled objectspublic java.lang.String javaToRepresentation(java.lang.Object object, WriterStreamDataProvider<?> streamDataProvider) throws java.lang.UnsupportedOperationException, java.lang.ClassCastException
ObjectTranslator
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
interfaceObjectTranslator.hasStringRepresentation()
public O representationToJava(java.lang.String representation, ReaderStreamDataProvider<?> streamDataProvider) throws InvalidObjectSourceDataException, java.lang.UnsupportedOperationException
ObjectTranslator
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.)InvalidObjectSourceDataException
- if the specified string representation cannot be parsed to a supported objectjava.lang.UnsupportedOperationException
- if objects handled by this instance can only be represented as XML