Class XStreamUtil
- java.lang.Object
-
- de.uni_trier.wi2.procake.utils.io.xstream.XStreamUtil
-
public class XStreamUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description XStreamUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> TfromJSON(String json)static <T> TfromJSON(String json, boolean useDataObjectIdRepresentation)static <T> TfromXML(String xml)static <T> TfromXML(String xml, boolean useDataObjectIdRepresentation)static Set<String>getDataClassNamesForIdRepresentation()static com.thoughtworks.xstream.XStreamgetXStreamInstance()static com.thoughtworks.xstream.XStreamgetXStreamInstance(boolean useDataObjectIdRepresentation)static com.thoughtworks.xstream.XStreamgetXStreamInstanceJson()static com.thoughtworks.xstream.XStreamgetXStreamInstanceJson(boolean useDataObjectIdRepresentation)static voidresetXStreamInstance()static voidresetXStreamInstance(boolean useDataObjectIdRepresentation)static voidresetXStreamInstanceJson()static voidresetXStreamInstanceJson(boolean useDataObjectIdRepresentation)static voidsetDataClassNamesForIdRepresentation(Set<String> classNames)static StringtoJSON(Object o)static StringtoJSON(Object o, boolean useDataObjectIdRepresentation)static StringtoXML(Object o)static StringtoXML(Object o, boolean useDataObjectIdRepresentation)
-
-
-
Method Detail
-
getDataClassNamesForIdRepresentation
public static Set<String> getDataClassNamesForIdRepresentation()
-
setDataClassNamesForIdRepresentation
public static void setDataClassNamesForIdRepresentation(Set<String> classNames)
- Parameters:
classNames- custom and system data class names of the data objects for which only the objectId should be serialized (if one exists)
-
getXStreamInstance
public static com.thoughtworks.xstream.XStream getXStreamInstance()
-
resetXStreamInstance
public static void resetXStreamInstance()
-
getXStreamInstance
public static com.thoughtworks.xstream.XStream getXStreamInstance(boolean useDataObjectIdRepresentation)
-
resetXStreamInstance
public static void resetXStreamInstance(boolean useDataObjectIdRepresentation)
-
getXStreamInstanceJson
public static com.thoughtworks.xstream.XStream getXStreamInstanceJson()
-
resetXStreamInstanceJson
public static void resetXStreamInstanceJson()
-
getXStreamInstanceJson
public static com.thoughtworks.xstream.XStream getXStreamInstanceJson(boolean useDataObjectIdRepresentation)
-
resetXStreamInstanceJson
public static void resetXStreamInstanceJson(boolean useDataObjectIdRepresentation)
-
toJSON
public static String toJSON(Object o)
- Parameters:
o- object to be serialized- Returns:
- string
-
toXML
public static String toXML(Object o, boolean useDataObjectIdRepresentation)
- Parameters:
o- object to be serializeduseDataObjectIdRepresentation- if true, only the objectId of a data object is serialized (if one exists). Make sure to register the data class names before with XStreamUtil.setDataClassNamesForIdRepresentation()- Returns:
- string
-
toJSON
public static String toJSON(Object o, boolean useDataObjectIdRepresentation)
- Parameters:
o- object to be serializeduseDataObjectIdRepresentation- if true, only the objectId of a data object is serialized (if one exists). Make sure to register the data class names before with XStreamUtil.setDataClassNamesForIdRepresentation()- Returns:
- string
-
fromXML
public static <T> T fromXML(String xml)
- Parameters:
xml- string to be deserialized- Returns:
- object
-
fromXML
public static <T> T fromXML(String xml, boolean useDataObjectIdRepresentation)
- Parameters:
xml- string to be deserializeduseDataObjectIdRepresentation- if true, only the objectId of a data object is serialized (if one exists). Make sure to register the data class names before with XStreamUtil.setDataClassNamesForIdRepresentation()- Returns:
- object
-
fromJSON
public static <T> T fromJSON(String json)
- Parameters:
json- string to be deserialized- Returns:
- object
-
fromJSON
public static <T> T fromJSON(String json, boolean useDataObjectIdRepresentation)
- Parameters:
json- string to be deserializeduseDataObjectIdRepresentation- if true, only the objectId of a data object is serialized (if one exists). Make sure to register the data class names before with XStreamUtil.setDataClassNamesForIdRepresentation()- Returns:
- object
-
-