Interface SerializerAdapter<T>

  • Type Parameters:
    T - the original serializer
    All Known Implementing Classes:
    JacksonAdapter

    public interface SerializerAdapter<T>
    This interface defines the behaviors an adapter of a serializer needs to implement.
    • Method Detail

      • serializer

        T serializer()
        Returns:
        the adapted original serializer
      • converterFactory

        retrofit2.Converter.Factory converterFactory()
        Returns:
        a converter factory for Retrofit
      • serialize

        String serialize​(Object object)
                  throws IOException
        Serializes an object into a JSON string.
        Parameters:
        object - the object to serialize.
        Returns:
        the serialized string. Null if the object to serialize is null.
        Throws:
        IOException - exception from serialization.
      • serializeRaw

        String serializeRaw​(Object object)
        Serializes an object into a raw string. The leading and trailing quotes will be trimmed.
        Parameters:
        object - the object to serialize.
        Returns:
        the serialized string. Null if the object to serialize is null.
      • serializeList

        String serializeList​(List<?> list,
                             CollectionFormat format)
        Serializes a list into a string with the delimiter specified with the Swagger collection format joining each individual serialized items in the list.
        Parameters:
        list - the list to serialize.
        format - the Swagger collection format.
        Returns:
        the serialized string
      • deserialize

        <U> U deserialize​(String value,
                          Type type)
                   throws IOException
        Deserializes a string into a SerializerAdapter object using the current SerializerAdapter.
        Type Parameters:
        U - the type of the deserialized object.
        Parameters:
        value - the string value to deserialize.
        type - the type to deserialize.
        Returns:
        the deserialized object.
        Throws:
        IOException - exception in deserialization