Package akka.http.javadsl.unmarshalling
Class Unmarshaller<A,B>
- java.lang.Object
-
- akka.http.javadsl.unmarshalling.Unmarshaller<A,B>
-
- All Implemented Interfaces:
UnmarshallerBase<A,B>
public abstract class Unmarshaller<A,B> extends java.lang.Object implements UnmarshallerBase<A,B>
An unmarshaller transforms values of type A into type B.
-
-
Constructor Summary
Constructors Constructor Description Unmarshaller()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Unmarshaller<A,B>
asScala()
<I> Unmarshaller<I,B>
asScalaCastInput()
INTERNAL APIstatic <A,B>
Unmarshaller<A,B>async(java.util.function.Function<A,java.util.concurrent.CompletionStage<B>> f)
Creates an unmarshaller from an asynchronous Java function.static Unmarshaller<HttpEntity,byte[]>
entityToByteArray()
static Unmarshaller<HttpEntity,akka.util.ByteString>
entityToByteString()
static Unmarshaller<HttpEntity,char[]>
entityToCharArray()
static Unmarshaller<HttpEntity,Multipart.ByteRanges>
entityToMultipartByteRangesUnmarshaller()
static Unmarshaller<HttpEntity,Multipart.FormData>
entityToMultipartFormData()
static Unmarshaller<HttpEntity,java.lang.String>
entityToString()
static Unmarshaller<HttpEntity,FormData>
entityToWwwUrlEncodedFormData()
static <A,B>
Unmarshaller<A,B>firstOf(Unmarshaller<A,B> u1, Unmarshaller<A,B> u2)
static <A,B>
Unmarshaller<A,B>firstOf(Unmarshaller<A,B> u1, Unmarshaller<A,B> u2, Unmarshaller<A,B> u3)
static <A,B>
Unmarshaller<A,B>firstOf(Unmarshaller<A,B> u1, Unmarshaller<A,B> u2, Unmarshaller<A,B> u3, Unmarshaller<A,B> u4)
static <A,B>
Unmarshaller<A,B>firstOf(Unmarshaller<A,B> u1, Unmarshaller<A,B> u2, Unmarshaller<A,B> u3, Unmarshaller<A,B> u4, Unmarshaller<A,B> u5)
<C> Unmarshaller<A,C>
flatMap(Unmarshaller<? super B,C> u)
<C> Unmarshaller<A,C>
flatMap(java.util.function.Function<B,java.util.concurrent.CompletionStage<C>> f)
static <B> Unmarshaller<HttpEntity,B>
forMediaType(MediaType t, Unmarshaller<HttpEntity,B> um)
static <B> Unmarshaller<HttpEntity,B>
forMediaTypes(java.lang.Iterable<MediaType> types, Unmarshaller<HttpEntity,B> um)
static <A,B>
Unmarshaller<A,B>fromScala(Unmarshaller<A,B> scalaUnmarshaller)
static Unmarshaller<HttpRequest,RequestEntity>
requestToEntity()
static <A,B>
Unmarshaller<A,B>sync(java.util.function.Function<A,B> f)
Creates an unmarshaller from a Java function.<C> Unmarshaller<A,C>
thenApply(java.util.function.Function<B,C> f)
Transform the resultB
of this unmarshaller to aC
producing a marshaller that turnsA
s intoC
sjava.util.concurrent.CompletionStage<B>
unmarshal(A value, akka.actor.ClassicActorSystemProvider system)
Apply this Unmarshaller to the given value.java.util.concurrent.CompletionStage<B>
unmarshal(A value, akka.stream.Materializer mat)
Apply this Unmarshaller to the given value.java.util.concurrent.CompletionStage<B>
unmarshal(A value, scala.concurrent.ExecutionContext ec, akka.actor.ClassicActorSystemProvider system)
Apply this Unmarshaller to the given value.java.util.concurrent.CompletionStage<B>
unmarshal(A value, scala.concurrent.ExecutionContext ec, akka.stream.Materializer mat)
Apply this Unmarshaller to the given value.
-
-
-
Method Detail
-
fromScala
public static <A,B> Unmarshaller<A,B> fromScala(Unmarshaller<A,B> scalaUnmarshaller)
-
async
public static <A,B> Unmarshaller<A,B> async(java.util.function.Function<A,java.util.concurrent.CompletionStage<B>> f)
Creates an unmarshaller from an asynchronous Java function.- Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
sync
public static <A,B> Unmarshaller<A,B> sync(java.util.function.Function<A,B> f)
Creates an unmarshaller from a Java function.- Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
entityToByteString
public static Unmarshaller<HttpEntity,akka.util.ByteString> entityToByteString()
-
entityToByteArray
public static Unmarshaller<HttpEntity,byte[]> entityToByteArray()
-
entityToCharArray
public static Unmarshaller<HttpEntity,char[]> entityToCharArray()
-
entityToString
public static Unmarshaller<HttpEntity,java.lang.String> entityToString()
-
entityToWwwUrlEncodedFormData
public static Unmarshaller<HttpEntity,FormData> entityToWwwUrlEncodedFormData()
-
entityToMultipartByteRangesUnmarshaller
public static Unmarshaller<HttpEntity,Multipart.ByteRanges> entityToMultipartByteRangesUnmarshaller()
-
entityToMultipartFormData
public static Unmarshaller<HttpEntity,Multipart.FormData> entityToMultipartFormData()
-
requestToEntity
public static Unmarshaller<HttpRequest,RequestEntity> requestToEntity()
-
forMediaType
public static <B> Unmarshaller<HttpEntity,B> forMediaType(MediaType t, Unmarshaller<HttpEntity,B> um)
-
forMediaTypes
public static <B> Unmarshaller<HttpEntity,B> forMediaTypes(java.lang.Iterable<MediaType> types, Unmarshaller<HttpEntity,B> um)
-
firstOf
public static <A,B> Unmarshaller<A,B> firstOf(Unmarshaller<A,B> u1, Unmarshaller<A,B> u2)
-
firstOf
public static <A,B> Unmarshaller<A,B> firstOf(Unmarshaller<A,B> u1, Unmarshaller<A,B> u2, Unmarshaller<A,B> u3)
-
firstOf
public static <A,B> Unmarshaller<A,B> firstOf(Unmarshaller<A,B> u1, Unmarshaller<A,B> u2, Unmarshaller<A,B> u3, Unmarshaller<A,B> u4)
-
firstOf
public static <A,B> Unmarshaller<A,B> firstOf(Unmarshaller<A,B> u1, Unmarshaller<A,B> u2, Unmarshaller<A,B> u3, Unmarshaller<A,B> u4, Unmarshaller<A,B> u5)
-
asScala
public abstract Unmarshaller<A,B> asScala()
-
asScalaCastInput
public <I> Unmarshaller<I,B> asScalaCastInput()
INTERNAL API
-
unmarshal
public java.util.concurrent.CompletionStage<B> unmarshal(A value, scala.concurrent.ExecutionContext ec, akka.stream.Materializer mat)
Apply this Unmarshaller to the given value.- Parameters:
value
- (undocumented)ec
- (undocumented)mat
- (undocumented)- Returns:
- (undocumented)
-
unmarshal
public java.util.concurrent.CompletionStage<B> unmarshal(A value, akka.stream.Materializer mat)
Apply this Unmarshaller to the given value. Uses the default materializerExecutionContext
. If you expect the marshalling to be heavy, it is suggested to provide a specialized context for those operations.- Parameters:
value
- (undocumented)mat
- (undocumented)- Returns:
- (undocumented)
-
unmarshal
public java.util.concurrent.CompletionStage<B> unmarshal(A value, scala.concurrent.ExecutionContext ec, akka.actor.ClassicActorSystemProvider system)
Apply this Unmarshaller to the given value.- Parameters:
value
- (undocumented)ec
- (undocumented)system
- (undocumented)- Returns:
- (undocumented)
-
unmarshal
public java.util.concurrent.CompletionStage<B> unmarshal(A value, akka.actor.ClassicActorSystemProvider system)
Apply this Unmarshaller to the given value. Uses the default materializerExecutionContext
. If you expect the marshalling to be heavy, it is suggested to provide a specialized context for those operations.- Parameters:
value
- (undocumented)system
- (undocumented)- Returns:
- (undocumented)
-
thenApply
public <C> Unmarshaller<A,C> thenApply(java.util.function.Function<B,C> f)
Transform the resultB
of this unmarshaller to aC
producing a marshaller that turnsA
s intoC
s- Parameters:
f
- (undocumented)- Returns:
- A new marshaller that can unmarshall instances of
A
into instances ofC
-
flatMap
public <C> Unmarshaller<A,C> flatMap(java.util.function.Function<B,java.util.concurrent.CompletionStage<C>> f)
-
flatMap
public <C> Unmarshaller<A,C> flatMap(Unmarshaller<? super B,C> u)
-
-