Package com.thoughtworks.xstream.io.json
Class JettisonMappedXmlDriver
- java.lang.Object
-
- com.thoughtworks.xstream.io.AbstractDriver
-
- com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver
-
- All Implemented Interfaces:
HierarchicalStreamDriver
public class JettisonMappedXmlDriver extends AbstractDriver
Simple XStream driver wrapping Jettison's Mapped reader and writer. Serializes object from and to JSON.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.codehaus.jettison.mapped.MappedNamespaceConventionconventionprotected org.codehaus.jettison.mapped.MappedXMLInputFactorymifprotected org.codehaus.jettison.mapped.MappedXMLOutputFactorymofprivate static java.lang.reflect.MethodsetRootElementArrayWrapperprotected booleanuseSerializeAsArray
-
Constructor Summary
Constructors Constructor Description JettisonMappedXmlDriver()Construct a JettisonMappedXmlDriver.JettisonMappedXmlDriver(org.codehaus.jettison.mapped.Configuration config)Construct a JettisonMappedXmlDriver with configuration.JettisonMappedXmlDriver(org.codehaus.jettison.mapped.Configuration config, boolean useSerializeAsArray)Construct a JettisonMappedXmlDriver with configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HierarchicalStreamReadercreateReader(java.io.File in)Create the HierarchicalStreamReader with the stream parser reading from a File.HierarchicalStreamReadercreateReader(java.io.InputStream input)Create the HierarchicalStreamReader with the stream parser reading from the input stream.HierarchicalStreamReadercreateReader(java.io.Reader reader)Create the HierarchicalStreamReader with the stream parser reading from the IO reader.HierarchicalStreamReadercreateReader(java.net.URL in)Create the HierarchicalStreamReader with the stream parser reading from a URL.HierarchicalStreamWritercreateWriter(java.io.OutputStream output)Create the HierarchicalStreamWriter with the formatted writer.HierarchicalStreamWritercreateWriter(java.io.Writer writer)Create the HierarchicalStreamWriter with the formatted writer.-
Methods inherited from class com.thoughtworks.xstream.io.AbstractDriver
getNameCoder
-
-
-
-
Field Detail
-
mof
protected final org.codehaus.jettison.mapped.MappedXMLOutputFactory mof
-
mif
protected final org.codehaus.jettison.mapped.MappedXMLInputFactory mif
-
convention
protected final org.codehaus.jettison.mapped.MappedNamespaceConvention convention
-
useSerializeAsArray
protected final boolean useSerializeAsArray
-
setRootElementArrayWrapper
private static final java.lang.reflect.Method setRootElementArrayWrapper
-
-
Constructor Detail
-
JettisonMappedXmlDriver
public JettisonMappedXmlDriver()
Construct a JettisonMappedXmlDriver.Note, you should turn off Jettison's root element array wrapper using Jettison 1.4.1 or higher.
-
JettisonMappedXmlDriver
public JettisonMappedXmlDriver(org.codehaus.jettison.mapped.Configuration config)
Construct a JettisonMappedXmlDriver with configuration.- Parameters:
config- the Jettison configuration
-
JettisonMappedXmlDriver
public JettisonMappedXmlDriver(org.codehaus.jettison.mapped.Configuration config, boolean useSerializeAsArray)Construct a JettisonMappedXmlDriver with configuration. This constructor has been added by special request of Jettison users to support JSON generated by older Jettison versions. If the driver is setup to ignore the XStream hints for JSON arrays, there is neither support from XStream's side nor are there any tests to ensure this mode. You should turn off Jettison's root element array wrapper using Jettison 1.4.1 or higher.- Parameters:
config- the Jettison configuration or null for XStream's defaultsuseSerializeAsArray- flag to use XStream's hints for collections and arrays- Since:
- 1.4
-
-
Method Detail
-
createReader
public HierarchicalStreamReader createReader(java.io.Reader reader)
Description copied from interface:HierarchicalStreamDriverCreate the HierarchicalStreamReader with the stream parser reading from the IO reader.- Parameters:
reader- theReaderwith the data to parse- Returns:
- the HierarchicalStreamReader
-
createReader
public HierarchicalStreamReader createReader(java.io.InputStream input)
Description copied from interface:HierarchicalStreamDriverCreate the HierarchicalStreamReader with the stream parser reading from the input stream.- Parameters:
input- theInputStreamwith the data to parse
-
createReader
public HierarchicalStreamReader createReader(java.net.URL in)
Description copied from class:AbstractDriverCreate the HierarchicalStreamReader with the stream parser reading from a URL. Depending on the parser implementation, some might take the URL as SystemId to resolve additional references.- Specified by:
createReaderin interfaceHierarchicalStreamDriver- Overrides:
createReaderin classAbstractDriver- Parameters:
in- theURLdefining the location with the data to parse- Returns:
- the HierarchicalStreamReader
-
createReader
public HierarchicalStreamReader createReader(java.io.File in)
Description copied from class:AbstractDriverCreate the HierarchicalStreamReader with the stream parser reading from a File. Depending on the parser implementation, some might take the file path as SystemId to resolve additional references.- Specified by:
createReaderin interfaceHierarchicalStreamDriver- Overrides:
createReaderin classAbstractDriver- Parameters:
in- theURLdefining the location with the data to parse- Returns:
- the HierarchicalStreamReader
-
createWriter
public HierarchicalStreamWriter createWriter(java.io.Writer writer)
Description copied from interface:HierarchicalStreamDriverCreate the HierarchicalStreamWriter with the formatted writer.- Parameters:
writer- theWriterto receive the formatted data- Returns:
- the HierarchicalStreamWriter
-
createWriter
public HierarchicalStreamWriter createWriter(java.io.OutputStream output)
Description copied from interface:HierarchicalStreamDriverCreate the HierarchicalStreamWriter with the formatted writer.- Parameters:
output- theOutputStreamto receive the formatted data- Returns:
- the HierarchicalStreamWriter
-
-