public class Marshaller<A,B>
extends java.lang.Object
Constructor and Description |
---|
Marshaller() |
Modifier and Type | Method and Description |
---|---|
Marshaller<A,B> |
asScala() |
<C> Marshaller<A,C> |
asScalaCastOutput()
INTERNAL API: involves unsafe cast (however is very fast)
|
static <T> Marshaller<T,RequestEntity> |
asScalaEntityMarshaller(Marshaller<T,RequestEntity> m) |
static <T> Marshaller<T,HttpResponse> |
asScalaToResponseMarshaller(Marshaller<T,HttpResponse> m) |
static Marshaller<byte[],RequestEntity> |
byteArrayToEntity() |
static Marshaller<org.apache.pekko.util.ByteString,RequestEntity> |
byteStringMarshaller(ContentType t) |
static Marshaller<org.apache.pekko.util.ByteString,RequestEntity> |
byteStringToEntity() |
static Marshaller<char[],RequestEntity> |
charArrayToEntity() |
<C> Marshaller<C,B> |
compose(java.util.function.Function<C,A> f) |
static <A,B1,B2 extends B1> |
downcast(Marshaller<A,B2> m)
Safe downcasting of the output type of the marshaller to a superclass.
|
static <A,B1,B2 extends B1> |
downcast(Marshaller<A,B2> m,
java.lang.Class<B1> target)
Safe downcasting of the output type of the marshaller to a superclass.
|
static <A> Marshaller<A,HttpResponse> |
entityToOKResponse(java.lang.Iterable<HttpHeader> headers,
Marshaller<A,? extends RequestEntity> m) |
static <A> Marshaller<A,HttpResponse> |
entityToOKResponse(Marshaller<A,? extends RequestEntity> m) |
static <A> Marshaller<A,HttpResponse> |
entityToResponse(StatusCode status,
java.lang.Iterable<HttpHeader> headers,
Marshaller<A,? extends RequestEntity> m) |
static <A,R extends RequestEntity> |
entityToResponse(StatusCode status,
Marshaller<A,R> m) |
static Marshaller<FormData,RequestEntity> |
formDataToEntity() |
static <A,B> Marshaller<A,B> |
fromScala(Marshaller<A,B> scalaMarshaller) |
<C> Marshaller<A,C> |
map(java.util.function.Function<B,C> f) |
static <A,B> Marshaller<A,B> |
oneOf(Marshaller<A,B> m1,
Marshaller<A,B> m2)
Helper for creating a "super-marshaller" from a number of "sub-marshallers".
|
static <A,B> Marshaller<A,B> |
oneOf(Marshaller<A,B> m1,
Marshaller<A,B> m2,
Marshaller<A,B> m3)
Helper for creating a "super-marshaller" from a number of "sub-marshallers".
|
static <A,B> Marshaller<A,B> |
oneOf(Marshaller<A,B> m1,
Marshaller<A,B> m2,
Marshaller<A,B> m3,
Marshaller<A,B> m4)
Helper for creating a "super-marshaller" from a number of "sub-marshallers".
|
static <A,B> Marshaller<A,B> |
oneOf(Marshaller<A,B> m1,
Marshaller<A,B> m2,
Marshaller<A,B> m3,
Marshaller<A,B> m4,
Marshaller<A,B> m5)
Helper for creating a "super-marshaller" from a number of "sub-marshallers".
|
static <A,B> Marshaller<A,B> |
oneOf(scala.collection.immutable.Seq<Marshaller<A,B>> ms)
Helper for creating a "super-marshaller" from a number of "sub-marshallers".
|
static <A,B> Marshaller<A,B> |
opaque(java.util.function.Function<A,B> f)
Helper for creating a synchronous
Marshaller to non-negotiable content from the given function. |
static <A> Marshaller<java.util.Optional<A>,RequestEntity> |
optionMarshaller(Marshaller<A,RequestEntity> m)
Marshals an Optional[A] to a RequestEntity an empty optional will yield an empty entity.
|
static Marshaller<java.lang.String,RequestEntity> |
stringToEntity() |
static <T> scala.Option<T> |
toOption(java.util.Optional<T> opt) |
static <A,B> Marshaller<A,B> |
withFixedContentType(ContentType contentType,
java.util.function.Function<A,B> f)
Helper for creating a synchronous
Marshaller to content with a fixed charset from the given function. |
static <A,B> Marshaller<A,B> |
withOpenCharset(MediaType.WithOpenCharset mediaType,
java.util.function.BiFunction<A,HttpCharset,B> f)
Helper for creating a synchronous
Marshaller to content with a negotiable charset from the given function. |
static <A,C> Marshaller<C,RequestEntity> |
wrapEntity(java.util.function.BiFunction<scala.concurrent.ExecutionContext,C,A> f,
Marshaller<A,RequestEntity> m,
MediaType mediaType) |
static <A,C,E extends RequestEntity> |
wrapEntity(java.util.function.Function<C,A> f,
Marshaller<A,E> m,
MediaType mediaType) |
public static <A,B> Marshaller<A,B> fromScala(Marshaller<A,B> scalaMarshaller)
public static <T> scala.Option<T> toOption(java.util.Optional<T> opt)
public static <A,B1,B2 extends B1> Marshaller<A,B1> downcast(Marshaller<A,B2> m)
Marshaller is covariant in B, i.e. if B2 is a subclass of B1, then Marshaller[X,B2] is OK to use where Marshaller[X,B1] is expected.
m
- (undocumented)public static <A,B1,B2 extends B1> Marshaller<A,B1> downcast(Marshaller<A,B2> m, java.lang.Class<B1> target)
Marshaller is covariant in B, i.e. if B2 is a subclass of B1, then Marshaller[X,B2] is OK to use where Marshaller[X,B1] is expected.
m
- (undocumented)target
- (undocumented)public static Marshaller<java.lang.String,RequestEntity> stringToEntity()
public static Marshaller<byte[],RequestEntity> byteArrayToEntity()
public static Marshaller<char[],RequestEntity> charArrayToEntity()
public static Marshaller<org.apache.pekko.util.ByteString,RequestEntity> byteStringToEntity()
public static Marshaller<FormData,RequestEntity> formDataToEntity()
public static Marshaller<org.apache.pekko.util.ByteString,RequestEntity> byteStringMarshaller(ContentType t)
public static <A> Marshaller<java.util.Optional<A>,RequestEntity> optionMarshaller(Marshaller<A,RequestEntity> m)
m
- (undocumented)public static <A,C> Marshaller<C,RequestEntity> wrapEntity(java.util.function.BiFunction<scala.concurrent.ExecutionContext,C,A> f, Marshaller<A,RequestEntity> m, MediaType mediaType)
public static <A,C,E extends RequestEntity> Marshaller<C,RequestEntity> wrapEntity(java.util.function.Function<C,A> f, Marshaller<A,E> m, MediaType mediaType)
public static <A> Marshaller<A,HttpResponse> entityToOKResponse(Marshaller<A,? extends RequestEntity> m)
public static <A,R extends RequestEntity> Marshaller<A,HttpResponse> entityToResponse(StatusCode status, Marshaller<A,R> m)
public static <A> Marshaller<A,HttpResponse> entityToResponse(StatusCode status, java.lang.Iterable<HttpHeader> headers, Marshaller<A,? extends RequestEntity> m)
public static <A> Marshaller<A,HttpResponse> entityToOKResponse(java.lang.Iterable<HttpHeader> headers, Marshaller<A,? extends RequestEntity> m)
public static <A,B> Marshaller<A,B> oneOf(scala.collection.immutable.Seq<Marshaller<A,B>> ms)
Please note that all passed in marshallers will actually be invoked in order to get the Marshalling object out of them, and later decide which of the marshallings should be returned. This is by-design, however in ticket as discussed in ticket https://github.com/akka/akka-http/issues/243 it MAY be changed in later versions of Pekko HTTP.
ms
- (undocumented)public static <A,B> Marshaller<A,B> oneOf(Marshaller<A,B> m1, Marshaller<A,B> m2)
Please note that all marshallers will actually be invoked in order to get the Marshalling object out of them, and later decide which of the marshallings should be returned. This is by-design, however in ticket as discussed in ticket https://github.com/akka/akka-http/issues/243 it MAY be changed in later versions of Pekko HTTP.
m1
- (undocumented)m2
- (undocumented)public static <A,B> Marshaller<A,B> oneOf(Marshaller<A,B> m1, Marshaller<A,B> m2, Marshaller<A,B> m3)
Please note that all marshallers will actually be invoked in order to get the Marshalling object out of them, and later decide which of the marshallings should be returned. This is by-design, however in ticket as discussed in ticket https://github.com/akka/akka-http/issues/243 it MAY be changed in later versions of Pekko HTTP.
m1
- (undocumented)m2
- (undocumented)m3
- (undocumented)public static <A,B> Marshaller<A,B> oneOf(Marshaller<A,B> m1, Marshaller<A,B> m2, Marshaller<A,B> m3, Marshaller<A,B> m4)
Please note that all marshallers will actually be invoked in order to get the Marshalling object out of them, and later decide which of the marshallings should be returned. This is by-design, however in ticket as discussed in ticket https://github.com/akka/akka-http/issues/243 it MAY be changed in later versions of Pekko HTTP.
m1
- (undocumented)m2
- (undocumented)m3
- (undocumented)m4
- (undocumented)public static <A,B> Marshaller<A,B> oneOf(Marshaller<A,B> m1, Marshaller<A,B> m2, Marshaller<A,B> m3, Marshaller<A,B> m4, Marshaller<A,B> m5)
Please note that all marshallers will actually be invoked in order to get the Marshalling object out of them, and later decide which of the marshallings should be returned. This is by-design, however in ticket as discussed in ticket https://github.com/akka/akka-http/issues/243 it MAY be changed in later versions of Pekko HTTP.
m1
- (undocumented)m2
- (undocumented)m3
- (undocumented)m4
- (undocumented)m5
- (undocumented)public static <A,B> Marshaller<A,B> withFixedContentType(ContentType contentType, java.util.function.Function<A,B> f)
Marshaller
to content with a fixed charset from the given function.contentType
- (undocumented)f
- (undocumented)public static <A,B> Marshaller<A,B> withOpenCharset(MediaType.WithOpenCharset mediaType, java.util.function.BiFunction<A,HttpCharset,B> f)
Marshaller
to content with a negotiable charset from the given function.mediaType
- (undocumented)f
- (undocumented)public static <A,B> Marshaller<A,B> opaque(java.util.function.Function<A,B> f)
Marshaller
to non-negotiable content from the given function.f
- (undocumented)public static <T> Marshaller<T,HttpResponse> asScalaToResponseMarshaller(Marshaller<T,HttpResponse> m)
public static <T> Marshaller<T,RequestEntity> asScalaEntityMarshaller(Marshaller<T,RequestEntity> m)
public Marshaller<A,B> asScala()
public <C> Marshaller<A,C> asScalaCastOutput()
public <C> Marshaller<A,C> map(java.util.function.Function<B,C> f)
public <C> Marshaller<C,B> compose(java.util.function.Function<C,A> f)