Package com.blackrook.small.roles
Interface XMLDriver
public interface XMLDriver
Describes an XML conversion driver for Small.
In order to return Objects from Content-annotated, EntryPath-annotated methods, a class
that implements this class needs to be in the component search.
Only one component needs to have this role. This is used for conversion if the output content MIME-type
is application/xml (and its family types). Unspecified output types are passed to a JSONDriver.
- Author:
- Matthew Tropiano
-
Method Summary
Modifier and TypeMethodDescription<T> TCalled when an object needs to be converted to an object from XML.default <T> TfromXMLString(String xml, Class<T> type) Converts an object to a XML string from an object.voidCalled when an object needs to be converted to XML from an object.default StringtoXMLString(Object retval) Converts an object to a XML string from an object.
-
Method Details
-
toXML
Called when an object needs to be converted to XML from an object.- Parameters:
writer- the writer to write to.object- the object to convert and write.- Throws:
IOException- if an error occurs during the write.
-
fromXML
Called when an object needs to be converted to an object from XML.- Type Parameters:
T- the return type.- Parameters:
reader- the provided reader to read XML from.type- the incoming type.- Returns:
- the converted object.
- Throws:
IOException- if an error occurs during the read.
-
toXMLString
Converts an object to a XML string from an object.- Parameters:
retval- the object to convert and write.- Returns:
- the resultant XML string.
- Throws:
IOException- if an error occurs during the write.
-
fromXMLString
Converts an object to a XML string from an object.- Type Parameters:
T- the return type.- Parameters:
xml- the input XML string.type- the incoming type.- Returns:
- the resultant XML string.
- Throws:
IOException- if an error occurs during the write.
-