buf.append(",");
}
key = entry.getKey();
val = entry.getValue();
final Marshaller valueMarshaller;
buf.append("\"").append(key).append("\"");
buf.append(":");
if (val == null) {
buf.append("null");
}
else {
if ((val instanceof Number && !(val instanceof BigInteger || val instanceof BigDecimal))
|| val instanceof Boolean || val instanceof Character) {
valueMarshaller = MarshallUtil.getQualifiedNumberMarshaller(val);
}
else {
if (!ctx.getMappingContext().hasMarshaller(val.getClass().getName())) {
val = val.toString();
valueMarshaller = StringMarshaller.INSTANCE;
}
else {
valueMarshaller = MarshallUtil.getMarshaller(MarshallUtil.maybeUnwrap(val), ctx);
}
}
if (val instanceof WrappedPortable) {
val = ((WrappedPortable) val).unwrap();
}
buf.append(valueMarshaller.marshall(val, ctx));
}
}
return buf.append("}").toString();
}