Class RentersAPIClient
java.lang.Object
info.ejava.assignments.api.houserenters.client.renters.RentersAPIClient
- All Implemented Interfaces:
RentersAPI
,RentersHttpIface
This class has been modified to leverage Spring HTTP Interface API, while retaining
backward-compatibility with legacy test infrastructure. The original intent of this
class was to encapsulate the details of making each HTTP call. It still does that,
but with the use of the annotated interface and dynamic proxy.
If something breaks or something custom must take place, we retain the ability to
put that in place here. This is not an all-or-nothing choice.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final URI
protected final RentersHttpIface
private final org.springframework.web.client.RestClient
Fields inherited from interface info.ejava.assignments.api.houserenters.client.renters.RentersHttpIface
RENTER_PATH, RENTERS_PATH
-
Constructor Summary
ConstructorsConstructorDescriptionRentersAPIClient
(org.springframework.web.client.RestTemplate restTemplate, ServerConfig serverConfig) RentersAPIClient
(org.springframework.web.client.RestTemplate restTemplate, URI baseUrl) RentersAPIClient
(org.springframework.web.client.RestTemplate restTemplate, URI baseUrl, Class<T> ifaceType) -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
<RenterDTO> createRenter
(RenterDTO renter) org.springframework.http.ResponseEntity
<RenterDTO> org.springframework.http.ResponseEntity
<RenterListDTO> getRenters
(Integer pageNumber, Integer pageSize) org.springframework.http.ResponseEntity
<RenterListDTO> getRenters
(org.springframework.data.domain.Pageable pageable) org.springframework.http.ResponseEntity
<Void> org.springframework.http.ResponseEntity
<Void> org.springframework.http.ResponseEntity
<Void> removeRenter
(String id) org.springframework.http.ResponseEntity
<RenterDTO> updateRenter
(String id, RenterDTO renter) withRestTemplate
(org.springframework.web.client.RestTemplate restTemplate)
-
Field Details
-
baseUrl
-
rentersHttpAPI
-
restClient
private final org.springframework.web.client.RestClient restClient
-
-
Constructor Details
-
RentersAPIClient
public RentersAPIClient(org.springframework.web.client.RestTemplate restTemplate, ServerConfig serverConfig) -
RentersAPIClient
-
RentersAPIClient
-
-
Method Details
-
withRestTemplate
- Specified by:
withRestTemplate
in interfaceRentersAPI
-
createRenter
- Specified by:
createRenter
in interfaceRentersHttpIface
-
getRenters
public org.springframework.http.ResponseEntity<RenterListDTO> getRenters(Integer pageNumber, Integer pageSize) - Specified by:
getRenters
in interfaceRentersHttpIface
-
getRenters
public org.springframework.http.ResponseEntity<RenterListDTO> getRenters(org.springframework.data.domain.Pageable pageable) - Specified by:
getRenters
in interfaceRentersAPI
-
getRenter
- Specified by:
getRenter
in interfaceRentersHttpIface
-
hasRenter
- Specified by:
hasRenter
in interfaceRentersHttpIface
-
updateRenter
- Specified by:
updateRenter
in interfaceRentersHttpIface
-
removeRenter
- Specified by:
removeRenter
in interfaceRentersHttpIface
-
removeAllRenters
- Specified by:
removeAllRenters
in interfaceRentersHttpIface
-