public class JsonUtil extends Object
Constructor and Description |
---|
JsonUtil() |
Modifier and Type | Method and Description |
---|---|
static <Y> Y |
basicValueFromJson(com.google.gwt.json.client.JSONValue jsonValue,
Class<Y> expectedType)
Converts the given JSONValue to the Java value of the given type.
|
static com.google.gwt.json.client.JSONValue |
basicValueToJson(Object value)
Returns a JSONValue that represents the given value, which must be one of
the JPA2 basic types.
|
static boolean |
equals(com.google.gwt.json.client.JSONValue v1,
com.google.gwt.json.client.JSONValue v2)
Compares two JSON values for equality by value.
|
public static com.google.gwt.json.client.JSONValue basicValueToJson(Object value)
value
- The value to convert to JSON. Must be a JPA2 basic type. Null is
permitted.value
. Never null (but might be
an instance of JSONNull).public static <Y> Y basicValueFromJson(com.google.gwt.json.client.JSONValue jsonValue, Class<Y> expectedType)
basicValueToJson(Object)
.jsonValue
- The value to convert from JSON. Not null.expectedType
- The Java type to convert to. Not null.value
. Will be null if the given
JSONValue is a JSONNull.public static boolean equals(com.google.gwt.json.client.JSONValue v1, com.google.gwt.json.client.JSONValue v2)
If the actual type of v1 and v2 differs, the values are considered unequal (that is, type coercion is never performed when doing a comparison).
This method returns true under the following conditions:
v1
- One of the values to compare. Must not be null (but JSONNull is
permitted).v2
- The other value to compare. Must not be null (but JSONNull is
permitted).Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.