org.springframework.web.reactive.function.server

## Interface EntityResponse<T>

Type Parameters:
  `T` - the entity type

All Superinterfaces:
  ServerResponse

    public interface EntityResponse<T>
    extends ServerResponse

Entity-specific subtype of `ServerResponse` that exposes entity data.

Since:
  5.0
Author:
  Arjen Poutsma, Juergen Hoeller

### Nested Class Summary

Nested Classes
`static interface` `EntityResponse.Builder<T>` Defines a builder for `EntityResponse`.

### Nested classes/interfaces inherited from interface org.springframework.web.reactive.function.server.ServerResponse

`ServerResponse.BodyBuilder, ServerResponse.Context, ServerResponse.HeadersBuilder<B extends ServerResponse.HeadersBuilder<B>>`

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Default Methods
`T` `entity()` Return the entity that makes up this response.
`static <T> EntityResponse.Builder<T>` `fromObject(T body)` Create a builder with the given object.
`static <T> EntityResponse.Builder<T>` `fromProducer(T producer, Class<?> elementClass)` Create a builder with the given producer.
`static <T> EntityResponse.Builder<T>` `fromProducer(T producer, org.springframework.core.ParameterizedTypeReference<?> typeReference)` Create a builder with the given producer.
`static <T,P extends org.reactivestreams.Publisher<T>> EntityResponse.Builder<P>` `fromPublisher(P publisher, Class<T> elementClass)` Create a builder with the given publisher.
`static <T,P extends org.reactivestreams.Publisher<T>> EntityResponse.Builder<P>` `fromPublisher(P publisher, org.springframework.core.ParameterizedTypeReference<T> typeReference)` Create a builder with the given publisher.
`BodyInserter<T,? super org.springframework.http.server.reactive.ServerHttpResponse>` `inserter()` Return the `BodyInserter` that writes the entity to the output stream.

### Methods inherited from interface org.springframework.web.reactive.function.server.ServerResponse

`accepted, badRequest, cookies, created, from, headers, noContent, notFound, ok, permanentRedirect, rawStatusCode, seeOther, status, status, statusCode, temporaryRedirect, unprocessableEntity, writeTo`

### Method Detail

#### entity

    T entity()

Return the entity that makes up this response.

#### inserter

    BodyInserter<T,? super org.springframework.http.server.reactive.ServerHttpResponse> inserter()

Return the `BodyInserter` that writes the entity to the output stream.

#### fromObject

    static <T> EntityResponse.Builder<T> fromObject(T body)

Create a builder with the given object.

Type Parameters:
  `T` - the type of the body
Parameters:
  `body` - the object that represents the body of the response
Returns:
  the created builder

#### fromProducer

    static <T> EntityResponse.Builder<T> fromProducer(T producer,
                                                      Class<?> elementClass)

Create a builder with the given producer.

Parameters:
  `producer` - the producer that represents the body of the response
  `elementClass` - the class of elements contained in the publisher
Returns:
  the created builder
Since:
  5.2

#### fromProducer

    static <T> EntityResponse.Builder<T> fromProducer(T producer,
                                                      org.springframework.core.ParameterizedTypeReference<?> typeReference)

Create a builder with the given producer.

Parameters:
  `producer` - the producer that represents the body of the response
  `typeReference` - the type of elements contained in the producer
Returns:
  the created builder
Since:
  5.2

#### fromPublisher

    static <T,P extends org.reactivestreams.Publisher<T>> EntityResponse.Builder<P> fromPublisher(P publisher,
                                                                                                  Class<T> elementClass)

Create a builder with the given publisher.

Type Parameters:
  `T` - the type of the elements contained in the publisher
  `P` - the type of the `Publisher`
Parameters:
  `publisher` - the publisher that represents the body of the response
  `elementClass` - the class of elements contained in the publisher
Returns:
  the created builder

#### fromPublisher

    static <T,P extends org.reactivestreams.Publisher<T>> EntityResponse.Builder<P> fromPublisher(P publisher,
                                                                                                  org.springframework.core.ParameterizedTypeReference<T> typeReference)

Create a builder with the given publisher.

Type Parameters:
  `T` - the type of the elements contained in the publisher
  `P` - the type of the `Publisher`
Parameters:
  `publisher` - the publisher that represents the body of the response
  `typeReference` - the type of elements contained in the publisher
Returns:
  the created builder