public final class ResponseContainer<T> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ResponseContainer.DataResponse<T> |
static class |
ResponseContainer.ErrorResponse |
Modifier and Type | Field and Description |
---|---|
ResponseContainer.DataResponse<T> |
data |
List<ResponseContainer.ErrorResponse> |
errors |
Modifier and Type | Method and Description |
---|---|
static <T> ResponseContainer<T> |
dataResponse(T data)
Construct a new data response.
|
static ResponseContainer<?> |
errorResponse(List<ResponseContainer.ErrorResponse> errors)
Construct a new error response.
|
String |
toString() |
void |
write(com.fasterxml.jackson.databind.ObjectMapper mapper,
javax.servlet.http.HttpServletResponse response)
Write the response to the HttpServletResponse, closing the ServletOutputStream when
completed.
|
public final ResponseContainer.DataResponse<T> data
public final List<ResponseContainer.ErrorResponse> errors
public static ResponseContainer<?> errorResponse(List<ResponseContainer.ErrorResponse> errors)
public static <T> ResponseContainer<T> dataResponse(T data)
public void write(com.fasterxml.jackson.databind.ObjectMapper mapper, javax.servlet.http.HttpServletResponse response) throws IOException
IOException