Converted the original Adapter implementation to a pluggable adapter implementation (with a narrow interface compared to the previous wide adapter interface). Won't merge this yet until J.J can compare the 2 adapter implementations in the next meeting.
The main classes involved with the adapter are as follows:
RequestParser.java represents the target interface that parses a request body to a JsonObject
RequestParserImpl.java represents the default implementation of the target interface
APIRequest.java takes a RequestParser parameter to parse the request body for the getJsonBody method
RequestParserAdapter.java represents the pluggable adapter that takes 2 delegate functions of type:
RequestParserDelegate.java (a functional interface that takes an Object representing the raw body to parse and returns JsonObject)
RequestTransformerDelegate.java (a functional interface that takes an APIRequest parameter and converts it to an Object that the RequestParserDelegate can parse, defaults to APIRequest.getBody)
APIRequestFactory.java creates APIRequests from a HttpServletRequest
RequestParserFactory.java takes APIRequests, examines their Content-Type and returns a RequestParser implementation suitable for parsing the body to JSON. This implementation can be the default JSON parser or a registered adapter
RequestParsingConfig.java registers the adapters and their associated content types with the RequestParserFactory class. Uses the AdaptersConfigurer Spring Bean
AdaptersConfigurer.java allows chaining of calls to register adapters to it. Used by RequestParsingConfig.java
Converted the original Adapter implementation to a pluggable adapter implementation (with a narrow interface compared to the previous wide adapter interface). Won't merge this yet until J.J can compare the 2 adapter implementations in the next meeting.
The main classes involved with the adapter are as follows: