Class Marshaller$
- java.lang.Object
-
- akka.http.javadsl.marshalling.Marshaller$
-
public class Marshaller$ extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static Marshaller$
MODULE$
Static reference to the singleton instance of this Scala object.
-
Constructor Summary
Constructors Constructor Description Marshaller$()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Marshaller<T,RequestEntity>
asScalaEntityMarshaller(Marshaller<T,RequestEntity> m)
<T> Marshaller<T,HttpResponse>
asScalaToResponseMarshaller(Marshaller<T,HttpResponse> m)
Marshaller<byte[],RequestEntity>
byteArrayToEntity()
Marshaller<akka.util.ByteString,RequestEntity>
byteStringMarshaller(ContentType t)
Marshaller<akka.util.ByteString,RequestEntity>
byteStringToEntity()
Marshaller<char[],RequestEntity>
charArrayToEntity()
<A,B1,B2 extends B1>
Marshaller<A,B1>downcast(Marshaller<A,B2> m)
Safe downcasting of the output type of the marshaller to a superclass.<A,B1,B2 extends B1>
Marshaller<A,B1>downcast(Marshaller<A,B2> m, java.lang.Class<B1> target)
Safe downcasting of the output type of the marshaller to a superclass.<A> Marshaller<A,HttpResponse>
entityToOKResponse(Marshaller<A,? extends RequestEntity> m)
<A> Marshaller<A,HttpResponse>
entityToOKResponse(java.lang.Iterable<HttpHeader> headers, Marshaller<A,? extends RequestEntity> m)
<A,R extends RequestEntity>
Marshaller<A,HttpResponse>entityToResponse(StatusCode status, Marshaller<A,R> m)
<A> Marshaller<A,HttpResponse>
entityToResponse(StatusCode status, java.lang.Iterable<HttpHeader> headers, Marshaller<A,? extends RequestEntity> m)
Marshaller<FormData,RequestEntity>
formDataToEntity()
<A,B>
Marshaller<A,B>fromScala(Marshaller<A,B> scalaMarshaller)
<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".<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".<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".<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".<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".<A,B>
Marshaller<A,B>opaque(java.util.function.Function<A,B> f)
Helper for creating a synchronousMarshaller
to non-negotiable content from the given function.<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.Marshaller<java.lang.String,RequestEntity>
stringToEntity()
<T> scala.Option<T>
toOption(java.util.Optional<T> opt)
<A,B>
Marshaller<A,B>withFixedContentType(ContentType contentType, java.util.function.Function<A,B> f)
Helper for creating a synchronousMarshaller
to content with a fixed charset from the given function.<A,B>
Marshaller<A,B>withOpenCharset(MediaType.WithOpenCharset mediaType, java.util.function.BiFunction<A,HttpCharset,B> f)
Helper for creating a synchronousMarshaller
to content with a negotiable charset from the given function.<A,C>
Marshaller<C,RequestEntity>wrapEntity(java.util.function.BiFunction<scala.concurrent.ExecutionContext,C,A> f, Marshaller<A,RequestEntity> m, MediaType mediaType)
<A,C,E extends RequestEntity>
Marshaller<C,RequestEntity>wrapEntity(java.util.function.Function<C,A> f, Marshaller<A,E> m, MediaType mediaType)
-
-
-
Field Detail
-
MODULE$
public static final Marshaller$ MODULE$
Static reference to the singleton instance of this Scala object.
-
-
Method Detail
-
fromScala
public <A,B> Marshaller<A,B> fromScala(Marshaller<A,B> scalaMarshaller)
-
toOption
public <T> scala.Option<T> toOption(java.util.Optional<T> opt)
-
downcast
public <A,B1,B2 extends B1> Marshaller<A,B1> downcast(Marshaller<A,B2> m)
Safe downcasting of the output type of the marshaller to a superclass.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.
- Parameters:
m
- (undocumented)- Returns:
- (undocumented)
-
downcast
public <A,B1,B2 extends B1> Marshaller<A,B1> downcast(Marshaller<A,B2> m, java.lang.Class<B1> target)
Safe downcasting of the output type of the marshaller to a superclass.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.
- Parameters:
m
- (undocumented)target
- (undocumented)- Returns:
- (undocumented)
-
stringToEntity
public Marshaller<java.lang.String,RequestEntity> stringToEntity()
-
byteArrayToEntity
public Marshaller<byte[],RequestEntity> byteArrayToEntity()
-
charArrayToEntity
public Marshaller<char[],RequestEntity> charArrayToEntity()
-
byteStringToEntity
public Marshaller<akka.util.ByteString,RequestEntity> byteStringToEntity()
-
formDataToEntity
public Marshaller<FormData,RequestEntity> formDataToEntity()
-
byteStringMarshaller
public Marshaller<akka.util.ByteString,RequestEntity> byteStringMarshaller(ContentType t)
-
optionMarshaller
public <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.- Parameters:
m
- (undocumented)- Returns:
- (undocumented)
-
wrapEntity
public <A,C> Marshaller<C,RequestEntity> wrapEntity(java.util.function.BiFunction<scala.concurrent.ExecutionContext,C,A> f, Marshaller<A,RequestEntity> m, MediaType mediaType)
-
wrapEntity
public <A,C,E extends RequestEntity> Marshaller<C,RequestEntity> wrapEntity(java.util.function.Function<C,A> f, Marshaller<A,E> m, MediaType mediaType)
-
entityToOKResponse
public <A> Marshaller<A,HttpResponse> entityToOKResponse(Marshaller<A,? extends RequestEntity> m)
-
entityToResponse
public <A,R extends RequestEntity> Marshaller<A,HttpResponse> entityToResponse(StatusCode status, Marshaller<A,R> m)
-
entityToResponse
public <A> Marshaller<A,HttpResponse> entityToResponse(StatusCode status, java.lang.Iterable<HttpHeader> headers, Marshaller<A,? extends RequestEntity> m)
-
entityToOKResponse
public <A> Marshaller<A,HttpResponse> entityToOKResponse(java.lang.Iterable<HttpHeader> headers, Marshaller<A,? extends RequestEntity> m)
-
oneOf
public <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". Content-negotiation determines, which "sub-marshaller" eventually gets to do the job.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 Akka HTTP.
- Parameters:
ms
- (undocumented)- Returns:
- (undocumented)
-
oneOf
public <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". Content-negotiation determines, which "sub-marshaller" eventually gets to do the job.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 Akka HTTP.
- Parameters:
m1
- (undocumented)m2
- (undocumented)- Returns:
- (undocumented)
-
oneOf
public <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". Content-negotiation determines, which "sub-marshaller" eventually gets to do the job.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 Akka HTTP.
- Parameters:
m1
- (undocumented)m2
- (undocumented)m3
- (undocumented)- Returns:
- (undocumented)
-
oneOf
public <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". Content-negotiation determines, which "sub-marshaller" eventually gets to do the job.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 Akka HTTP.
- Parameters:
m1
- (undocumented)m2
- (undocumented)m3
- (undocumented)m4
- (undocumented)- Returns:
- (undocumented)
-
oneOf
public <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". Content-negotiation determines, which "sub-marshaller" eventually gets to do the job.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 Akka HTTP.
- Parameters:
m1
- (undocumented)m2
- (undocumented)m3
- (undocumented)m4
- (undocumented)m5
- (undocumented)- Returns:
- (undocumented)
-
withFixedContentType
public <A,B> Marshaller<A,B> withFixedContentType(ContentType contentType, java.util.function.Function<A,B> f)
Helper for creating a synchronousMarshaller
to content with a fixed charset from the given function.- Parameters:
contentType
- (undocumented)f
- (undocumented)- Returns:
- (undocumented)
-
withOpenCharset
public <A,B> Marshaller<A,B> withOpenCharset(MediaType.WithOpenCharset mediaType, java.util.function.BiFunction<A,HttpCharset,B> f)
Helper for creating a synchronousMarshaller
to content with a negotiable charset from the given function.- Parameters:
mediaType
- (undocumented)f
- (undocumented)- Returns:
- (undocumented)
-
opaque
public <A,B> Marshaller<A,B> opaque(java.util.function.Function<A,B> f)
Helper for creating a synchronousMarshaller
to non-negotiable content from the given function.- Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
asScalaToResponseMarshaller
public <T> Marshaller<T,HttpResponse> asScalaToResponseMarshaller(Marshaller<T,HttpResponse> m)
-
asScalaEntityMarshaller
public <T> Marshaller<T,RequestEntity> asScalaEntityMarshaller(Marshaller<T,RequestEntity> m)
-
-