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 URIprotected final RentersHttpIfaceprivate final org.springframework.web.client.RestClientFields 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:
withRestTemplatein interfaceRentersAPI
-
createRenter
- Specified by:
createRenterin interfaceRentersHttpIface
-
getRenters
public org.springframework.http.ResponseEntity<RenterListDTO> getRenters(Integer pageNumber, Integer pageSize) - Specified by:
getRentersin interfaceRentersHttpIface
-
getRenters
public org.springframework.http.ResponseEntity<RenterListDTO> getRenters(org.springframework.data.domain.Pageable pageable) - Specified by:
getRentersin interfaceRentersAPI
-
getRenter
- Specified by:
getRenterin interfaceRentersHttpIface
-
hasRenter
- Specified by:
hasRenterin interfaceRentersHttpIface
-
updateRenter
- Specified by:
updateRenterin interfaceRentersHttpIface
-
removeRenter
- Specified by:
removeRenterin interfaceRentersHttpIface
-
removeAllRenters
- Specified by:
removeAllRentersin interfaceRentersHttpIface
-