Class ResponseMapper
- java.lang.Object
-
- de.adorsys.psd2.xs2a.service.mapper.ResponseMapper
-
@Component public class ResponseMapper extends Object
ResponseMapper class should be used for success responses mapping only. In case of unsuccessful error mapping IllegalArgumentException would be thrown - ResponseErrorMapper should be used for such cases.
-
-
Constructor Summary
Constructors Constructor Description ResponseMapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> org.springframework.http.ResponseEntityaccepted(ResponseObject<T> response)GeneratesResponseEntitywith the response body in response to a request that hasn't been processed yet<T> org.springframework.http.ResponseEntitycreated(ResponseObject<T> response)GeneratesResponseEntitywith the response body in response to a successful resource creation request<T> org.springframework.http.ResponseEntitycreated(ResponseObject<T> response, ResponseHeaders responseHeaders)GeneratesResponseEntitywith the response body in response to a successful resource creation request<T,R>
org.springframework.http.ResponseEntity<?>created(ResponseObject<T> response, Function<T,R> mapper)GeneratesResponseEntitywith the response body in response to a successful resource creation request<T,R>
org.springframework.http.ResponseEntity<?>created(ResponseObject<T> response, Function<T,R> mapper, ResponseHeaders responseHeaders)GeneratesResponseEntitywith the response body in response to a successful resource creation request<T> org.springframework.http.ResponseEntitydelete(ResponseObject<T> response)GeneratesResponseEntitywith the response body in response to a successful resource deletion request<T,R>
org.springframework.http.ResponseEntity<?>delete(ResponseObject<T> response, Function<T,R> mapper)GeneratesResponseEntitywith the response body in response to a successful resource deletion request<T> org.springframework.http.ResponseEntityok(ResponseObject<T> response)GeneratesResponseEntitywith the response body in response to a generic successful request<T,R>
org.springframework.http.ResponseEntity<?>ok(ResponseObject<T> response, Function<T,R> mapper)GeneratesResponseEntitywith the response body in response to a generic successful request<T,R>
org.springframework.http.ResponseEntity<?>ok(ResponseObject<T> response, Function<T,R> mapper, ResponseHeaders responseHeaders)GeneratesResponseEntitywith the response body and headers in response to a generic successful request
-
-
-
Method Detail
-
ok
public <T,R> org.springframework.http.ResponseEntity<?> ok(ResponseObject<T> response, Function<T,R> mapper)
GeneratesResponseEntitywith the response body in response to a generic successful request- Type Parameters:
T- type of the body in the response objectR- type of the transformed body- Parameters:
response- response object from the service with the body insidemapper- function for transforming body into another type- Returns:
- response entity with OK HTTP status and body
-
created
public <T,R> org.springframework.http.ResponseEntity<?> created(ResponseObject<T> response, Function<T,R> mapper)
GeneratesResponseEntitywith the response body in response to a successful resource creation request- Type Parameters:
T- type of the body in the response objectR- type of the transformed body- Parameters:
response- response object from the service with the body insidemapper- function for transforming body into another type- Returns:
- response entity with Created HTTP status and body
-
delete
public <T,R> org.springframework.http.ResponseEntity<?> delete(ResponseObject<T> response, Function<T,R> mapper)
GeneratesResponseEntitywith the response body in response to a successful resource deletion request- Type Parameters:
T- type of the body in the response objectR- type of the transformed body- Parameters:
response- response object from the service with the body insidemapper- function for transforming body into another type- Returns:
- response entity with No Content HTTP status and body
-
ok
public <T,R> org.springframework.http.ResponseEntity<?> ok(ResponseObject<T> response, Function<T,R> mapper, ResponseHeaders responseHeaders)
GeneratesResponseEntitywith the response body and headers in response to a generic successful request- Type Parameters:
T- type of the body in the response objectR- type of the body after applying mapper- Parameters:
response- response object from the service with the body insidemapper- function for transforming body into another typeresponseHeaders- headers to be returned in the response- Returns:
- response entity with OK HTTP status, body and headers
-
created
public <T,R> org.springframework.http.ResponseEntity<?> created(ResponseObject<T> response, Function<T,R> mapper, ResponseHeaders responseHeaders)
GeneratesResponseEntitywith the response body in response to a successful resource creation request- Type Parameters:
T- type of the body in the response objectR- type of the body after applying mapper- Parameters:
response- response object from the service with the body insidemapper- function for transforming body into another typeresponseHeaders- headers to be returned in the response- Returns:
- response entity with Created HTTP status, body and headers
-
created
public <T> org.springframework.http.ResponseEntity created(ResponseObject<T> response, ResponseHeaders responseHeaders)
GeneratesResponseEntitywith the response body in response to a successful resource creation request- Type Parameters:
T- type of the body in the response object- Parameters:
response- response object from the service with the body insideresponseHeaders- headers to be returned in the response- Returns:
- response entity with Created HTTP status, body and headers
-
ok
public <T> org.springframework.http.ResponseEntity ok(ResponseObject<T> response)
GeneratesResponseEntitywith the response body in response to a generic successful request- Type Parameters:
T- type of the body in the response object- Parameters:
response- response object from the service with the body inside- Returns:
- response entity with OK HTTP status and body
-
created
public <T> org.springframework.http.ResponseEntity created(ResponseObject<T> response)
GeneratesResponseEntitywith the response body in response to a successful resource creation request- Type Parameters:
T- type of the body in the response object- Parameters:
response- response object from the service with the body inside- Returns:
- response entity with Created HTTP status and body
-
delete
public <T> org.springframework.http.ResponseEntity delete(ResponseObject<T> response)
GeneratesResponseEntitywith the response body in response to a successful resource deletion request- Type Parameters:
T- type of the body in the response object- Parameters:
response- response object from the service with the body inside- Returns:
- response entity with No Content HTTP status and body
-
accepted
public <T> org.springframework.http.ResponseEntity accepted(ResponseObject<T> response)
GeneratesResponseEntitywith the response body in response to a request that hasn't been processed yet- Type Parameters:
T- type of the body in the response object- Parameters:
response- response object from the service with the body inside- Returns:
- response entity with Accepted HTTP status and body
-
-