public class XSHelper
extends com.thoughtworks.xstream.XStream
| Modifier and Type | Field and Description |
|---|---|
boolean |
hideErrors |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
clone(T obj)
Performs a deep clone using serialisation; this is equivalent to
(MyType) this.deserialise(this.serialise(obj))Be careful when using this to clone classes you do not own: they may refer to complex/system datastructures with unintended consequences |
static XSHelper |
create()
Creates a new instance of the XSHelper class, using the most efficient underlying implementations possible
|
static XSHelper |
create(com.thoughtworks.xstream.io.HierarchicalStreamDriver drv) |
<T> T |
deserialise(java.io.File f)
Deserialises an Object from a File.
|
<T> T |
deserialise(java.io.InputStream stream)
Deserialise an XML document from an InputStream into an Object
|
<T> T |
deserialise(java.io.Reader stream)
Deserialise an XML document from an InputStream into an Object
|
<T> T |
deserialise(java.lang.String xml)
Deserialises a String into an Object
|
XSHelper |
disableGraph() |
XSHelper |
enableGraph() |
int |
getMode()
Returns the current graphing mode
|
boolean |
getPrettyPrint() |
static boolean |
hasXPP3()
Determines if XPP3 is available, caching the results of the first query
|
void |
parseAnnotations(java.lang.Class<?>... classes) |
BooleanMessage |
serialise(java.io.File f,
java.lang.Object o)
Serialises an object into an OutputStream
|
java.lang.String |
serialise(java.lang.Object o)
Serialises an object into a String
|
BooleanMessage |
serialise(java.io.OutputStream os,
java.lang.Object o)
Serialises an object into an OutputStream
|
BooleanMessage |
serialise(java.io.Writer os,
java.lang.Object o)
Serialises an object into an OutputStream
|
void |
setMode(int mode)
Sets the current graphing mode, logging its value for use in this class.
Possible values are: XStream.NO_REFERENCES, XStream.XPATH_RELATIVE_REFERENCES, XStream.XPATH_ABSOLUTE_REFERENCES,
XStream.ID_REFERENCES |
void |
setNoObjectGraph(boolean disable) |
XSHelper |
setPrettyPrint(boolean value)
Enables/Disables pretty printing (indented XML output)
|
addDefaultImplementation, addImmutableType, addImplicitArray, addImplicitArray, addImplicitArray, addImplicitCollection, addImplicitCollection, addImplicitCollection, addImplicitMap, addImplicitMap, alias, alias, aliasAttribute, aliasAttribute, aliasField, aliasPackage, aliasSystemAttribute, aliasType, autodetectAnnotations, createObjectInputStream, createObjectInputStream, createObjectInputStream, createObjectOutputStream, createObjectOutputStream, createObjectOutputStream, createObjectOutputStream, createObjectOutputStream, createObjectOutputStream, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, getClassLoader, getConverterLookup, getMapper, getReflectionProvider, marshal, marshal, newDataHolder, omitField, processAnnotations, processAnnotations, registerConverter, registerConverter, registerConverter, registerConverter, registerLocalConverter, registerLocalConverter, setClassLoader, setMarshallingStrategy, setupAliases, setupConverters, setupDefaultImplementations, setupImmutableTypes, toXML, toXML, toXML, unmarshal, unmarshal, unmarshal, useAttributeFor, useAttributeFor, useAttributeFor, useXStream11XmlFriendlyMapper, wrapMapperpublic static boolean hasXPP3()
public static XSHelper create()
public static XSHelper create(com.thoughtworks.xstream.io.HierarchicalStreamDriver drv)
public void parseAnnotations(java.lang.Class<?>... classes)
public BooleanMessage serialise(java.io.OutputStream os, java.lang.Object o)
os - The OutputStream to useo - The object to serialisepublic BooleanMessage serialise(java.io.Writer os, java.lang.Object o)
os - The Writer to useo - The object to serialisepublic BooleanMessage serialise(java.io.File f, java.lang.Object o)
os - The OutputStream to useo - The object to serialisepublic java.lang.String serialise(java.lang.Object o)
o - The object to serialisepublic <T> T deserialise(java.io.File f)
f - The file to deserialisepublic <T> T deserialise(java.lang.String xml)
xml - The XML document to deserialisepublic <T> T deserialise(java.io.InputStream stream)
stream - The InputStreampublic <T> T deserialise(java.io.Reader stream)
stream - The Readerpublic <T> T clone(T obj)
(MyType) this.deserialise(this.serialise(obj))T - some classobj - some objectpublic void setNoObjectGraph(boolean disable)
public XSHelper enableGraph()
public XSHelper disableGraph()
public void setMode(int mode)
XStream.NO_REFERENCES, XStream.XPATH_RELATIVE_REFERENCES, XStream.XPATH_ABSOLUTE_REFERENCES,
XStream.ID_REFERENCESsetMode in class com.thoughtworks.xstream.XStreampublic boolean getPrettyPrint()
public XSHelper setPrettyPrint(boolean value)
value - true for pretty printing, false for compact outputthis (for chaining)public int getMode()
Copyright © 2014. All Rights Reserved.