cz.eman.jsonrpc.shared
Enum JsonTransformer
java.lang.Object
java.lang.Enum<JsonTransformer>
cz.eman.jsonrpc.shared.JsonTransformer
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<JsonTransformer>
public enum JsonTransformer
- extends java.lang.Enum<JsonTransformer>
UtilClass for transforming from and to JSON.
- Author:
- Karel Hovorka
Method Summary |
static org.codehaus.jackson.map.ObjectMapper |
getMapper()
|
static java.lang.String |
toJson(java.lang.Class<?> cl)
|
static java.lang.String |
toJson(JsonRpcResponse result)
|
static java.lang.String |
toJson(java.lang.Object object)
|
static java.lang.Object |
toObject(java.lang.String json,
java.lang.Class<?> cl)
|
static JsonTransformer |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static JsonTransformer[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared. |
Methods inherited from class java.lang.Enum |
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
INSTANCE
public static final JsonTransformer INSTANCE
values
public static JsonTransformer[] values()
- Returns an array containing the constants of this enum type, in
the order they are declared. This method may be used to iterate
over the constants as follows:
for (JsonTransformer c : JsonTransformer.values())
System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in
the order they are declared
valueOf
public static JsonTransformer valueOf(java.lang.String name)
- Returns the enum constant of this type with the specified name.
The string must match exactly an identifier used to declare an
enum constant in this type. (Extraneous whitespace characters are
not permitted.)
- Parameters:
name
- the name of the enum constant to be returned.
- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified name
java.lang.NullPointerException
- if the argument is null
toJson
public static java.lang.String toJson(java.lang.Class<?> cl)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException
- Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException
toObject
public static java.lang.Object toObject(java.lang.String json,
java.lang.Class<?> cl)
throws org.codehaus.jackson.JsonParseException,
org.codehaus.jackson.map.JsonMappingException,
java.io.IOException
- Throws:
org.codehaus.jackson.JsonParseException
org.codehaus.jackson.map.JsonMappingException
java.io.IOException
toJson
public static java.lang.String toJson(java.lang.Object object)
toJson
public static java.lang.String toJson(JsonRpcResponse result)
getMapper
public static org.codehaus.jackson.map.ObjectMapper getMapper()