Modifier and Type | Method and Description |
---|---|
java.lang.Object |
decode(java.lang.String archive)
Decode the JSON string
|
static java.lang.Object |
defaultDecode(java.lang.String archive)
Decode the JSON string using the default coder
|
static java.lang.String |
defaultEncode(java.lang.Object value)
Encode the object as a JSON string using the default encoder
|
java.lang.String |
encode(java.lang.Object value)
Encode the object as a JSON string
|
protected ConversionAdaptor<?,?> |
getConversionAdaptor(java.lang.String valueType)
Get the conversion adaptor for the given value
|
static java.util.List<java.lang.String> |
getDefaultTypes()
Get a list of types (including JSON standard types plus default extensions) which are supported for coding and decoding
|
java.util.List<java.lang.String> |
getExtendedTypes()
Get a list of types which extend beyond the JSON standard types
|
static JSONCoder |
getInstance()
get a new JSON Coder only if you need to customize it, otherwise use the static methods to encode/decode
|
static java.util.List<java.lang.String> |
getStandardTypes()
Get a list of the standard types encoded directly into JSON
|
java.util.List<java.lang.String> |
getSupportedTypes()
Get a list of all types which are supported for coding and decoding
|
static boolean |
isStandardType(java.lang.String type)
Determine whether the specified type is a standard JSON type
|
<CustomType,RepresentationType> |
registerType(java.lang.Class<CustomType> type,
ConversionAdaptor<CustomType,RepresentationType> adaptor)
Register the custom type by class and its associated adaptor
|
public static JSONCoder getInstance()
public static java.util.List<java.lang.String> getDefaultTypes()
public static java.util.List<java.lang.String> getStandardTypes()
public static boolean isStandardType(java.lang.String type)
public java.util.List<java.lang.String> getSupportedTypes()
getSupportedTypes
in interface Coder
public java.util.List<java.lang.String> getExtendedTypes()
public <CustomType,RepresentationType> void registerType(java.lang.Class<CustomType> type, ConversionAdaptor<CustomType,RepresentationType> adaptor)
registerType
in interface Coder
type
- type to identify and process for encoding and decodingadaptor
- translator between the custom type and representation JSON constructsprotected ConversionAdaptor<?,?> getConversionAdaptor(java.lang.String valueType)
public static java.lang.Object defaultDecode(java.lang.String archive)
archive
- JSON string representation of an objectpublic java.lang.Object decode(java.lang.String archive)
public static java.lang.String defaultEncode(java.lang.Object value)
value
- the object to encode