Class JsonMapper
- java.lang.Object
-
- org.springframework.cloud.function.json.JsonMapper
-
- Direct Known Subclasses:
GsonMapper
,JacksonMapper
public abstract class JsonMapper extends Object
- Author:
- Dave Syer, Oleg Zhurakousky
-
-
Constructor Summary
Constructors Constructor Description JsonMapper()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract <T> T
doFromJson(Object json, Type type)
<T> T
fromJson(Object json, Type type)
static boolean
isJsonString(Object value)
Performs a simple validation on an object to see if it appears to be a JSON string.static boolean
isJsonStringRepresentsCollection(Object value)
static boolean
isJsonStringRepresentsMap(Object value)
byte[]
toJson(Object value)
abstract String
toString(Object value)
-
-
-
Method Detail
-
toJson
public byte[] toJson(Object value)
-
isJsonString
public static boolean isJsonString(Object value)
Performs a simple validation on an object to see if it appears to be a JSON string. NOTE: the validation is very rudimentary and simply checks that the object is a String and begins and ends with matching pairs of "{}" or "[]" or "\"\"" and therefore may not handle some corner cases. Primarily intended for internal of the framework.- Parameters:
value
- candidate object to evaluate- Returns:
- true if and object appears to be a valid JSON string, otherwise false.
-
isJsonStringRepresentsCollection
public static boolean isJsonStringRepresentsCollection(Object value)
-
isJsonStringRepresentsMap
public static boolean isJsonStringRepresentsMap(Object value)
-
-