if (o == null) {
outstream.write("null".getBytes(UTF_8));
return;
}
final EncodingSession ctx = (EncodingSession) mSession;
final Class cls = o.getClass();
if (definition.getMappingClass().isEnum()) {
final Enum enumer = (Enum) o;
outstream.write(("{\"" + SerializationParts.ENCODED_TYPE + "\":\""
+ enumer.getDeclaringClass().getName() + "\""
+ ",\"" + SerializationParts.ENUM_STRING_VALUE + "\":\"" + enumer.name() + "\"}")
.getBytes(UTF_8));
return;
}
final boolean enc = ctx.hasObject(o);
final String hash = ctx.getObject(o);
if (enc) {
/**
* If this object is referencing a duplicate object in the graph, we only provide an ID reference.
*/