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 Details

    • JsonMapper

      public JsonMapper()
  • Method Details

    • fromJson

      public <T> T fromJson(Object json, Type type)
    • doFromJson

      protected abstract <T> T doFromJson(Object json, Type type)
    • toJson

      public byte[] toJson(Object value)
    • toString

      public abstract String toString(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)