Interface C2Serializer

All Known Implementing Classes:
C2JacksonSerializer

public interface C2Serializer
Helper class to support central configuration and functionality for serialisation / deserialisation
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> Optional<T>
    convert(Object content, com.fasterxml.jackson.core.type.TypeReference<T> valueType)
    Helper to convert a JSON object into a specific type
    <T> Optional<T>
    deserialize(String content, Class<T> valueType)
    Helper to deserialize an object
    serialize(T content)
    Helper to serialise object
  • Method Details

    • serialize

      <T> Optional<String> serialize(T content)
      Helper to serialise object
      Type Parameters:
      T - the type of the object
      Parameters:
      content - object to be serialised
      Returns:
      the serialised string representation of the parameter object if it was successful empty otherwise
    • deserialize

      <T> Optional<T> deserialize(String content, Class<T> valueType)
      Helper to deserialize an object
      Type Parameters:
      T - the type of the target object
      Parameters:
      content - the string representation of the object to be deserialized
      valueType - the class of the target object
      Returns:
      the deserialised object if successful empty otherwise
    • convert

      <T> Optional<T> convert(Object content, com.fasterxml.jackson.core.type.TypeReference<T> valueType)
      Helper to convert a JSON object into a specific type
      Type Parameters:
      T - the type of the target object
      Parameters:
      content - the string representation of the object to be deserialized
      valueType - the class of the target object
      Returns:
      the converted object if the conversion was successful empty otherwise