As part of the dependencies that the project I'm working on has, we use several core services. These services, to which we can't make big changes, are a big mess. Depending on the method we invoke, we need to convert our parameters (and return values) to different encodings, locales and time zones.Since we generate these parameters in multiple places in our own code, we perform these conversions in multiple places. Some times where we generate them, before passing them around in our side; some times right before invoking the method in the core service. So the mess is spreading throughout our code, and I want to introduce a layer to isolate it.My question is what's the best approach for that. Initially I thought of just creating a service/method corresponding to each service/method that we need to use. These methods would simply perform the conversion, delegate to the core services and perform conversion of the return value. But this seems somehow unwieldy.Then I thought of using annotations, but I'm not completely sure of how to use them. And as I understand it, ideally I would need to annotate the invoked method. For instance, I could annotate the parameters with @converToUtc, and do the conversion in the annotation implementation. Is this correct? Of course, this is hard because it's not our code and it'll break code currently using those methods in projects other than our.What's the best approach for this situation?
Implementing a complexity hiding layer
java;clean code;layers