|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Marshall
This interface represents the functionality to convert a JSON representation to/from a Java representation. The serializer's goal is to preserve as much Java structure as possible: primitive types, arrays, object clusters containing recursive references and so on. As a consequence, the generated JSON is rather terse. The serializer is the best choice in a Java centric application where you want to write some object structures to JSON in a readable form. If the emphasis is on clean JSON, take a look at the Mapper tool, which does not support all Java constructs but which emits nice JSON which can easily be parsed in e.g. Javascript. * The main difference between the serializer and the mapper is that the serializer keeps as much type information and structure information in the JSON data where the mapper uses the type information in the provided Java classes to interprete the JSON data.
Method Summary | |
---|---|
JSONObject |
marshall(boolean aValue)
Convert a boolean primitive to JSON. |
JSONObject |
marshall(byte aValue)
Convert a byte primitive to JSON. |
JSONObject |
marshall(char aValue)
Convert a char primitive to JSON. |
JSONObject |
marshall(double aValue)
Convert a double primitive to JSON. |
JSONObject |
marshall(float aValue)
Convert a float primitive to JSON. |
JSONObject |
marshall(int aValue)
Convert an int primitive to JSON. |
JSONObject |
marshall(long aValue)
Convert a long primitive to JSON. |
JSONObject |
marshall(Object aObj)
Convert a Java object to JSON. |
JSONObject |
marshall(short aValue)
Convert a short primitive to JSON. |
MarshallValue |
unmarshall(JSONObject aElement)
Convert a JSON representation to the Java primitive or reference. |
Method Detail |
---|
JSONObject marshall(boolean aValue)
aValue
-
JSONObject marshall(byte aValue)
aValue
-
JSONObject marshall(short aValue)
aValue
-
JSONObject marshall(char aValue)
aValue
-
JSONObject marshall(int aValue)
aValue
-
JSONObject marshall(long aValue)
aValue
-
JSONObject marshall(float aValue)
aValue
-
JSONObject marshall(double aValue)
aValue
-
JSONObject marshall(Object aObj) throws MarshallException
aObj
-
MarshallException
- An error occured while converting the Java object to JSON.MarshallValue unmarshall(JSONObject aElement) throws MarshallException
aElement
-
MarshallException
- An error occured while trying to convert the JSON representation into a
Java representation.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |