/** * Creates a 200 OK {@link Response} with the given payload of type {@link T} . * * @param payload The payload to respond with * @param <T> The response payload type * @return A response object with the given payload */ static <T> Response<T> forPayload(T payload) { return ResponseImpl.create(payload); }
/** * Creates a {@link Response} with the given status code and a payload with type {@link T}. * * @param statusCode The status code * @param payload The payload to respond with * @param <T> The response payload type * @return A response object with the given status code and payload */ static <T> Response<T> of(StatusType statusCode, T payload) { return ResponseImpl.create(statusCode, payload); } }
/** * Creates a {@link Response} with the given status code. * * If {@code code} is OK, this function will be equivalent to {@link #ok()}. * * @param statusCode The status code * @param <T> The response payload type * @return A response object with the given status code */ static <T> Response<T> forStatus(StatusType statusCode) { return ResponseImpl.create(statusCode); }
/** * Creates a 200 OK {@link Response} with the given payload of type {@link T} . * * @param payload The payload to respond with * @param <T> The response payload type * @return A response object with the given payload */ static <T> Response<T> forPayload(T payload) { return ResponseImpl.create(payload); }
/** * Creates a {@link Response} with the given status code. * * If {@code code} is OK, this function will be equivalent to {@link #ok()}. * * @param statusCode The status code * @param <T> The response payload type * @return A response object with the given status code */ static <T> Response<T> forStatus(StatusType statusCode) { return ResponseImpl.create(statusCode); }
/** * Creates a {@link Response} with the given status code and a payload with type {@link T}. * * @param statusCode The status code * @param payload The payload to respond with * @param <T> The response payload type * @return A response object with the given status code and payload */ static <T> Response<T> of(StatusType statusCode, T payload) { return ResponseImpl.create(statusCode, payload); } }