protected XStream getXStream() throws Exception {
XStream xstream;
if (format.equals("json")) {
xstream = new XStream(new JettisonMappedXmlDriver()) {
protected MapperWrapper wrapMapper(MapperWrapper next) {
return new MapperWrapper(next) {
public boolean shouldSerializeMember(Class definedIn, String fieldName) {
return definedIn != Object.class ? super.shouldSerializeMember(definedIn, fieldName) : false;
}
};
}
};
} else if (format.equals("xml")) {
xstream = new XStream() {
protected MapperWrapper wrapMapper(MapperWrapper next) {
return new MapperWrapper(next) {
public boolean shouldSerializeMember(Class definedIn, String fieldName) {
return definedIn != Object.class ? super.shouldSerializeMember(definedIn, fieldName) : false;
}
};