Interface ContentTransformer


@ExtensionPoint public interface ContentTransformer
Transforms ByteSource content to an object and vice versa. This class is an extension point, this means that plugins can define their own ContentTransformer implementations by implementing the interface and annotate the implementation with the Extension annotation.
Since:
1.46
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isResponsible(Class<?> type, String contentType)
    Returns true if the transformer is responsible for the given object and content type.
    com.google.common.io.ByteSource
    marshall(Object object)
    Marshalls the given object into a ByteSource.
    <T> T
    unmarshall(Class<T> type, com.google.common.io.ByteSource content)
    Unmarshall the ByteSource content to an object of the given type.
  • Method Details

    • isResponsible

      boolean isResponsible(Class<?> type, String contentType)
      Returns true if the transformer is responsible for the given object and content type.
      Parameters:
      type - object type
      contentType - content type
    • marshall

      com.google.common.io.ByteSource marshall(Object object)
      Marshalls the given object into a ByteSource.
      Parameters:
      object - object to marshall
      Returns:
      string content
    • unmarshall

      <T> T unmarshall(Class<T> type, com.google.common.io.ByteSource content)
      Unmarshall the ByteSource content to an object of the given type.
      Type Parameters:
      T - type of result object
      Parameters:
      type - type of result object
      content - content