Package com.linecorp.armeria.client
Interface ResponseAs<T,R>
- All Known Subinterfaces:
FutureResponseAs<T>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Transforms a response into another.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <V> ResponseAs<T,
V> andThen
(ResponseAs<R, V> after) Returns a composedResponseAs
that first applies thisResponseAs
to its input, and then applies theafter
ResponseAs
to the result.Transforms the response into another.blocking()
Aggregates anHttpResponse
and waits the result ofHttpResponse.aggregate()
.static FutureResponseAs<ResponseEntity<byte[]>>
bytes()
Aggregates anHttpResponse
and converts theAggregatedHttpObject.content()
into bytes.static <T> FutureResponseAs<ResponseEntity<T>>
json
(TypeReference<? extends T> typeRef) Aggregates anHttpResponse
and deserializes the JSONAggregatedHttpObject.content()
into the specified Java type using the defaultObjectMapper
.static <T> FutureResponseAs<ResponseEntity<T>>
json
(TypeReference<? extends T> typeRef, ObjectMapper mapper) Aggregates anHttpResponse
and deserializes the JSONAggregatedHttpObject.content()
into the specified Java type using the specifiedObjectMapper
.static <T> FutureResponseAs<ResponseEntity<T>>
Aggregates anHttpResponse
and deserializes the JSONAggregatedHttpObject.content()
into the specified non-container type using the defaultObjectMapper
.static <T> FutureResponseAs<ResponseEntity<T>>
json
(Class<? extends T> clazz, ObjectMapper mapper) Aggregates anHttpResponse
and deserializes the JSONAggregatedHttpObject.content()
into the specified non-container type using the specifiedObjectMapper
.static FutureResponseAs<ResponseEntity<Path>>
Writes the content of anHttpResponse
into the specifiedPath
.default boolean
Returns whether the response should be aggregated.static FutureResponseAs<ResponseEntity<String>>
string()
-
Method Details
-
blocking
Aggregates anHttpResponse
and waits the result ofHttpResponse.aggregate()
. -
bytes
Aggregates anHttpResponse
and converts theAggregatedHttpObject.content()
into bytes. -
string
-
path
Writes the content of anHttpResponse
into the specifiedPath
. -
json
Aggregates anHttpResponse
and deserializes the JSONAggregatedHttpObject.content()
into the specified non-container type using the defaultObjectMapper
.Note that this method should NOT be used if the result type is a container (
Collection
orMap
. Usejson(TypeReference)
for the container type.- See Also:
-
json
@UnstableApi static <T> FutureResponseAs<ResponseEntity<T>> json(Class<? extends T> clazz, ObjectMapper mapper) Aggregates anHttpResponse
and deserializes the JSONAggregatedHttpObject.content()
into the specified non-container type using the specifiedObjectMapper
.Note that this method should NOT be used if the result type is a container (
Collection
orMap
. Usejson(TypeReference, ObjectMapper)
for the container type. -
json
@UnstableApi static <T> FutureResponseAs<ResponseEntity<T>> json(TypeReference<? extends T> typeRef) Aggregates anHttpResponse
and deserializes the JSONAggregatedHttpObject.content()
into the specified Java type using the defaultObjectMapper
.- See Also:
-
json
@UnstableApi static <T> FutureResponseAs<ResponseEntity<T>> json(TypeReference<? extends T> typeRef, ObjectMapper mapper) Aggregates anHttpResponse
and deserializes the JSONAggregatedHttpObject.content()
into the specified Java type using the specifiedObjectMapper
. -
as
Transforms the response into another. -
requiresAggregation
Returns whether the response should be aggregated. -
andThen
Returns a composedResponseAs
that first applies thisResponseAs
to its input, and then applies theafter
ResponseAs
to the result.
-