return writer;\r
}\r
\r
+ /** Writes all fields of the specified object to the current JSON object. */\r
public void writeFields (Object object) {\r
Class type = object.getClass();\r
\r
return values;\r
}\r
\r
+ /** @see #writeField(Object, String, String, Class) */\r
public void writeField (Object object, String name) {\r
writeField(object, name, name, null);\r
}\r
\r
- /** @param elementType May be null if the type is unknown. */\r
+ /** @param elementType May be null if the type is unknown.\r
+ * @see #writeField(Object, String, String, Class) */\r
public void writeField (Object object, String name, Class elementType) {\r
writeField(object, name, name, elementType);\r
}\r
\r
+ /** @see #writeField(Object, String, String, Class) */\r
public void writeField (Object object, String fieldName, String jsonName) {\r
writeField(object, fieldName, jsonName, null);\r
}\r
\r
- /** @param elementType May be null if the type is unknown. */\r
+ /** Writes the specified field to the current JSON object.\r
+ * @param elementType May be null if the type is unknown. */\r
public void writeField (Object object, String fieldName, String jsonName, Class elementType) {\r
Class type = object.getClass();\r
ObjectMap<String, FieldMetadata> fields = typeToFields.get(type);\r
}\r
}\r
\r
- /** @param value May be null. */\r
+ /** Writes the value as a field on the current JSON object, without writing the actual class.\r
+ * @param value May be null.\r
+ * @see #writeValue(String, Object, Class, Class) */\r
public void writeValue (String name, Object value) {\r
try {\r
writer.name(name);\r
writeValue(value, value.getClass(), null);\r
}\r
\r
- /** @param value May be null.\r
- * @param knownType May be null if the type is unknown. */\r
+ /** Writes the value as a field on the current JSON object, writing the class of the object if it differs from the specified\r
+ * known type.\r
+ * @param value May be null.\r
+ * @param knownType May be null if the type is unknown.\r
+ * @see #writeValue(String, Object, Class, Class) */\r
public void writeValue (String name, Object value, Class knownType) {\r
try {\r
writer.name(name);\r
writeValue(value, knownType, null);\r
}\r
\r
- /** @param value May be null.\r
+ /** Writes the value as a field on the current JSON object, writing the class of the object if it differs from the specified\r
+ * known type. The specified element type is used as the default type for collections.\r
+ * @param value May be null.\r
* @param knownType May be null if the type is unknown.\r
* @param elementType May be null if the type is unknown. */\r
public void writeValue (String name, Object value, Class knownType, Class elementType) {\r
writeValue(value, knownType, elementType);\r
}\r
\r
- /** @param value May be null. */\r
+ /** Writes the value, without writing the class of the object.\r
+ * @param value May be null. */\r
public void writeValue (Object value) {\r
if (value == null)\r
writeValue(value, null, null);\r
writeValue(value, value.getClass(), null);\r
}\r
\r
- /** @param value May be null.\r
+ /** Writes the value, writing the class of the object if it differs from the specified known type.\r
+ * @param value May be null.\r
* @param knownType May be null if the type is unknown. */\r
public void writeValue (Object value, Class knownType) {\r
writeValue(value, knownType, null);\r
}\r
\r
- /** @param value May be null.\r
+ /** Writes the value, writing the class of the object if it differs from the specified known type. The specified element type is\r
+ * used as the default type for collections.\r
+ * @param value May be null.\r
* @param knownType May be null if the type is unknown.\r
* @param elementType May be null if the type is unknown. */\r
public void writeValue (Object value, Class knownType, Class elementType) {\r
}\r
}\r
\r
- /** @param knownType May be null if the type is unknown. */\r
+ /** Starts writing an object, writing the actualType to a field if needed.\r
+ * @param knownType May be null if the type is unknown. */\r
public void writeObjectStart (Class actualType, Class knownType) {\r
try {\r
writer.object();\r