Class C2JacksonSerializer

java.lang.Object
org.apache.nifi.c2.serializer.C2JacksonSerializer
All Implemented Interfaces:
C2Serializer

public class C2JacksonSerializer extends Object implements C2Serializer
  • Field Details

    • logger

      private static final org.slf4j.Logger logger
    • objectMapper

      private final com.fasterxml.jackson.databind.ObjectMapper objectMapper
  • Constructor Details

    • C2JacksonSerializer

      public C2JacksonSerializer()
  • Method Details

    • serialize

      public <T> Optional<String> serialize(T object)
      Description copied from interface: C2Serializer
      Helper to serialise object
      Specified by:
      serialize in interface C2Serializer
      Type Parameters:
      T - the type of the object
      Parameters:
      object - object to be serialised
      Returns:
      the serialised string representation of the parameter object if it was successful empty otherwise
    • deserialize

      public <T> Optional<T> deserialize(String content, Class<T> valueType)
      Description copied from interface: C2Serializer
      Helper to deserialise an object
      Specified by:
      deserialize in interface C2Serializer
      Type Parameters:
      T - the type of the target object
      Parameters:
      content - the string representation of the object to be deserialsed
      valueType - the class of the target object
      Returns:
      the deserialised object if successful empty otherwise