Class Serialization


  • public class Serialization
    extends Object
    • Method Detail

      • jsonMapper

        public static com.fasterxml.jackson.databind.ObjectMapper jsonMapper()
      • yamlMapper

        public static com.fasterxml.jackson.databind.ObjectMapper yamlMapper()
      • asJson

        public static <T> String asJson​(T object)
      • asYaml

        public static <T> String asYaml​(T object)
      • unmarshal

        public static <T> T unmarshal​(InputStream is)
        Unmarshals a stream.
        Type Parameters:
        T - The target type.
        Parameters:
        is - The InputStream.
        Returns:
        returns de-serialized object
      • unmarshal

        public static <T> T unmarshal​(InputStream is,
                                      Map<String,​String> parameters)
        Unmarshals a stream optionally performing placeholder substitution to the stream.
        Type Parameters:
        T - The target type.
        Parameters:
        is - The InputStream.
        parameters - A Map with parameters for placeholder substitution.
        Returns:
        returns returns de-serialized object
      • unmarshal

        public static <T> T unmarshal​(InputStream is,
                                      com.fasterxml.jackson.databind.ObjectMapper mapper)
        Unmarshals a stream.
        Type Parameters:
        T - The target type.
        Parameters:
        is - The InputStream.
        mapper - The ObjectMapper to use.
        Returns:
        returns de-serialized object
      • unmarshal

        public static <T> T unmarshal​(InputStream is,
                                      com.fasterxml.jackson.databind.ObjectMapper mapper,
                                      Map<String,​String> parameters)
        Unmarshals a stream optionally performing placeholder substitution to the stream.
        Type Parameters:
        T - The target type.
        Parameters:
        is - The InputStream.
        mapper - The ObjectMapper to use.
        parameters - A Map with parameters for placeholder substitution.
        Returns:
        returns de-serialized object
      • unmarshal

        public static <T> T unmarshal​(String str,
                                      Class<T> type)
        Unmarshals a String
        Type Parameters:
        T - template argument denoting type
        Parameters:
        str - The String.
        type - The target type.
        Returns:
        returns de-serialized object
      • unmarshal

        public static <T> T unmarshal​(String str,
                                      Class<T> type,
                                      Map<String,​String> parameters)
        Unmarshals a String optionally performing placeholder substitution to the String.
        Type Parameters:
        T - Template argument denoting type
        Parameters:
        str - The String.
        type - The target type.
        parameters - A hashmap containing parameters
        Returns:
        returns de-serialized object
      • unmarshal

        public static <T> T unmarshal​(InputStream is,
                                      Class<T> type)
        Unmarshals an InputStream.
        Type Parameters:
        T - Template argument denoting type
        Parameters:
        is - The InputStream.
        type - The type.
        Returns:
        returns de-serialized object
      • unmarshal

        public static <T> T unmarshal​(InputStream is,
                                      Class<T> type,
                                      Map<String,​String> parameters)
        Unmarshals an InputStream optionally performing placeholder substitution to the stream.
        Type Parameters:
        T - Template argument denoting type
        Parameters:
        is - The InputStream.
        type - The type.
        parameters - A Map with parameters for placeholder substitution.
        Returns:
        returns de-serialized object
      • unmarshal

        public static <T> T unmarshal​(InputStream is,
                                      com.fasterxml.jackson.core.type.TypeReference<T> type)
        Unmarshals an InputStream.
        Type Parameters:
        T - Template argument denoting type
        Parameters:
        is - The InputStream.
        type - The TypeReference.
        Returns:
        returns de-serialized object
      • unmarshal

        public static <T> T unmarshal​(InputStream is,
                                      com.fasterxml.jackson.core.type.TypeReference<T> type,
                                      Map<String,​String> parameters)
        Unmarshals an InputStream optionally performing placeholder substitution to the stream.
        Type Parameters:
        T - Template argument denoting type
        Parameters:
        is - The InputStream.
        type - The TypeReference.
        parameters - A Map with parameters for placeholder substitution.
        Returns:
        returns de-serialized object