Test Cases - XStream Object to-from json
Test Cases - XStream Object to-from json
This commit is contained in:
@@ -1,19 +1,23 @@
|
||||
package com.baeldung.initializer;
|
||||
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
|
||||
import com.thoughtworks.xstream.io.json.JsonHierarchicalStreamDriver;
|
||||
|
||||
public class SimpleXstreamInitializer {
|
||||
|
||||
private XStream xtreamInstance;
|
||||
public XStream getXstreamInstance() {
|
||||
XStream xtreamInstance = new XStream();
|
||||
return xtreamInstance;
|
||||
}
|
||||
|
||||
public XStream getXstreamInstance() {
|
||||
if (xtreamInstance == null) {
|
||||
synchronized (SimpleXstreamInitializer.class) {
|
||||
if (xtreamInstance == null) {
|
||||
xtreamInstance = new XStream();
|
||||
}
|
||||
}
|
||||
}
|
||||
return xtreamInstance;
|
||||
}
|
||||
public XStream getXstreamJettisonMappedInstance() {
|
||||
XStream xstreamInstance = new XStream(new JettisonMappedXmlDriver());
|
||||
return xstreamInstance;
|
||||
}
|
||||
|
||||
public XStream getXstreamJsonHierarchicalInstance() {
|
||||
XStream xstreamInstance = new XStream(new JsonHierarchicalStreamDriver());
|
||||
return xstreamInstance;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user