@Override public void writeCloseObject() { deep--; if (breakOnNewObject) { breakLine(this); } super.writeCloseObject(); }
@Override public void serializeValue(final JsonContext jsonContext, final Map<?, ?> map) { if (map.isEmpty() && jsonContext.isExcludeEmpty()) { return; } jsonContext.writeOpenObject(); int count = 0; Path currentPath = jsonContext.getPath(); for (Map.Entry<?, ?> entry : map.entrySet()) { Object key = entry.getKey(); Object value = entry.getValue(); count = serializeKeyValue(jsonContext, currentPath, key, value, count); } jsonContext.writeCloseObject(); }
@Override public void serializeValue(final JsonContext jsonContext, final JsonObject jsonObject) { jsonContext.writeOpenObject(); int count = 0; Path currentPath = jsonContext.getPath(); for (Map.Entry<String, ?> entry : jsonObject.map().entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); count = serializeKeyValue(jsonContext, currentPath, key, value, count); } jsonContext.writeCloseObject(); } }
@Override public void serializeValue(final JsonContext jsonContext, final Object value) { jsonContext.writeOpenObject(); BeanSerializer beanVisitor = new BeanSerializer(jsonContext, value); beanVisitor.serialize(); jsonContext.writeCloseObject(); }
@Override public void serializeValue(final JsonContext jsonContext, Object value) { jsonContext.writeOpenObject(); BeanSerializer beanVisitor = new BeanSerializer(jsonContext, value) { @Override protected void onSerializableProperty(String propertyName, Class propertyType, Object value) { if (value == null) { return; } super.onSerializableProperty(propertyName, propertyType, value); } }; beanVisitor.serialize(); jsonContext.writeCloseObject(); } });
@Override public void serializeValue(JsonContext jsonContext, PodMultiMap<?> map) { jsonContext.writeOpenObject(); int count = 0; Path currentPath = jsonContext.getPath(); for (String key : map.names()) { final List<?> list = map.getAll(key); Object value = list.size() == 1 ? list.get(0) : list; count = serializeKeyValue( jsonContext, currentPath, key, value, count); } jsonContext.writeCloseObject(); }