public class JsonCodec extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static interface |
JsonCodec.BeanProperty |
Modifier and Type | Method and Description |
---|---|
static Object |
decodeCustomType(Type targetType,
elemental.json.JsonValue value,
ConnectorTracker connectorTracker) |
static Object |
decodeInternalOrCustomType(Type targetType,
elemental.json.JsonValue value,
ConnectorTracker connectorTracker) |
static Object |
decodeInternalType(Type targetType,
boolean restrictToInternalTypes,
elemental.json.JsonValue encodedJsonValue,
ConnectorTracker connectorTracker)
Decodes a value that is of an internal type.
|
static EncodeResult |
encode(Object value,
elemental.json.JsonValue diffState,
Type valueType,
ConnectorTracker connectorTracker) |
static Collection<JsonCodec.BeanProperty> |
getProperties(Class<?> type) |
static boolean |
isInternalTransportType(String transportType) |
static boolean |
isInternalType(Type type) |
static boolean |
jsonEquals(elemental.json.JsonValue a,
elemental.json.JsonValue b)
Compares two json values for deep equality.
|
public static boolean isInternalTransportType(String transportType)
public static boolean isInternalType(Type type)
public static Object decodeInternalOrCustomType(Type targetType, elemental.json.JsonValue value, ConnectorTracker connectorTracker)
public static Object decodeCustomType(Type targetType, elemental.json.JsonValue value, ConnectorTracker connectorTracker)
public static Object decodeInternalType(Type targetType, boolean restrictToInternalTypes, elemental.json.JsonValue encodedJsonValue, ConnectorTracker connectorTracker)
Ensures the encoded value is of the same type as target type.
Allows restricting collections so that they must be declared using generics. If this is used then all objects in the collection are encoded using the declared type. Otherwise only internal types are allowed in collections.
targetType
- The type that should be returned by this methodrestrictToInternalTypes
- encodedJsonValue
- connectorTracker
- public static EncodeResult encode(Object value, elemental.json.JsonValue diffState, Type valueType, ConnectorTracker connectorTracker)
public static Collection<JsonCodec.BeanProperty> getProperties(Class<?> type) throws IntrospectionException
IntrospectionException
public static boolean jsonEquals(elemental.json.JsonValue a, elemental.json.JsonValue b)
JsonValue#equals(Object)
only does an identity check and
JsonValue.jsEquals(JsonValue)
is defined to use JavaScript
semantics where arrays and objects are equals only based on identity.a
- the first json value to check, may not be nullb
- the second json value to check, may not be nulltrue
if both json values are the same;
false
otherwiseCopyright © 2017 Vaadin Ltd. All rights reserved.