Junilu Lacar wrote:I think the wrapper concept is not appropriate here. It's abstracting at the wrong level.
Junilu Lacar wrote:In similiar situations, I would try to figure out a design where I only need to add new classes instead of adding new methods to an existing class to support additional domain types.
Junilu Lacar wrote:The design would also either allow configuration-based registration of the new domain classes or have some way of discovering domain classes as they are added to the system. If you go the discovery route, it would also adapt the system when types have been removed or obsoleted.
Junilu Lacar wrote:What's definitely smelly to me are all these classes that extend BaseWrapper. What are you "wrapping" with these classes anyway?
Junilu Lacar wrote:What do you gain from making all these classes extend BaseWrapper?
Junilu Lacar wrote:How can a DogWrapper be in the same class hierarchy as an ErrorWrapper?
Junilu Lacar wrote:Also, what exactly is your understanding of "clean code"? For me, the basic qualities of clean code is that it makes sense, that it's intent is clear, and that it's easy to work with. At the very least, the clarity of intent quality is lacking in this code.
Rob Spoor wrote:You can use @RequestParam this way, or you can use them for each query / form parameter separately. For instance, @RequestParam("fromDate") String fromDate, @RequestParam("toDate") String toDate. You may even be able to change the type now, and have Spring convert the strings for you.