java.lang.Object
org.apache.pekko.http.javadsl.marshallers.jackson.Jackson

public class Jackson extends Object
A JSON marshaller/unmarshaller using the Jackson library.
  • Constructor Details

    • Jackson

      public Jackson()
  • Method Details

    • marshaller

      public static <T> Marshaller<T,RequestEntity> marshaller()
      Returns a marshaller that converts a value of type T to a JSON RequestEntity using the default ObjectMapper.
      Type Parameters:
      T - the type of the value to marshal
    • marshaller

      public static <T> Marshaller<T,RequestEntity> marshaller(com.fasterxml.jackson.databind.ObjectMapper mapper)
      Returns a marshaller that converts a value of type T to a JSON RequestEntity using the given ObjectMapper.
      Type Parameters:
      T - the type of the value to marshal
      Parameters:
      mapper - the ObjectMapper to use for serialization
    • byteStringUnmarshaller

      public static <T> Unmarshaller<org.apache.pekko.util.ByteString,T> byteStringUnmarshaller(Class<T> expectedType)
      Returns an unmarshaller that converts a JSON ByteString to a value of the given type using the default ObjectMapper.
      Type Parameters:
      T - the target type
      Parameters:
      expectedType - the class of the target type
    • unmarshaller

      public static <T> Unmarshaller<HttpEntity,T> unmarshaller(Class<T> expectedType)
      Returns an unmarshaller that converts a JSON HttpEntity to a value of the given type using the default ObjectMapper.
      Type Parameters:
      T - the target type
      Parameters:
      expectedType - the class of the target type
    • unmarshaller

      public static <T> Unmarshaller<HttpEntity,T> unmarshaller(com.fasterxml.jackson.databind.ObjectMapper mapper, Class<T> expectedType)
      Returns an unmarshaller that converts a JSON HttpEntity to a value of the given type using the given ObjectMapper.
      Type Parameters:
      T - the target type
      Parameters:
      mapper - the ObjectMapper to use for deserialization
      expectedType - the class of the target type
    • byteStringUnmarshaller

      public static <T> Unmarshaller<org.apache.pekko.util.ByteString,T> byteStringUnmarshaller(com.fasterxml.jackson.databind.ObjectMapper mapper, Class<T> expectedType)
      Returns an unmarshaller that converts a JSON ByteString to a value of the given type using the given ObjectMapper.
      Type Parameters:
      T - the target type
      Parameters:
      mapper - the ObjectMapper to use for deserialization
      expectedType - the class of the target type