use of com.abubusoft.kripton.persistence.XmlWrapperSerializer in project kripton by xcesco.
the class AbstractMapper method serialize.
public void serialize(BinderContext context, E object, SerializerWrapper serializerWrapper, boolean writeStartAndEnd) throws Exception {
switch(context.getSupportedFormat()) {
case XML:
try {
XmlWrapperSerializer wrapper = ((XmlWrapperSerializer) serializerWrapper);
XMLSerializer xmlSerializer = wrapper.xmlSerializer;
if (writeStartAndEnd) {
xmlSerializer.writeStartDocument();
}
serializeOnXml(object, xmlSerializer, 0);
if (writeStartAndEnd) {
xmlSerializer.writeEndDocument();
}
} catch (Exception e) {
e.printStackTrace();
throw (new KriptonRuntimeException(e));
}
break;
default:
if (context.getSupportedFormat().onlyText)
serializeOnJacksonAsString(object, ((JacksonWrapperSerializer) serializerWrapper).jacksonGenerator);
else
serializeOnJackson(object, ((JacksonWrapperSerializer) serializerWrapper).jacksonGenerator);
break;
}
}
Aggregations