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> TdoFromJson(Object json, Type type)<T> TfromJson(Object json, Type type)static booleanisJsonString(Object value)Performs a simple validation on an object to see if it appears to be a JSON string.static booleanisJsonStringRepresentsCollection(Object value)static booleanisJsonStringRepresentsMap(Object value)byte[]toJson(Object value)abstract StringtoString(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)
-
-