Java experts: What's a modern JVM-ish way to do advice aka AOP (Aspect-Oriented programming)?
I'm looking to wrap all API calls performed by our hadoopfs library. It will measure number of calls and duration by context inside the client. So I'd like to wrap e.g. io.lakefs.clients.api.ObjectsApi inside a wrapper object. The wrapper will present the same interface as ObjectsApi (say, inherit from it), and will perform one action before calling the underlying method and another after it.
I control the calling code, but I have no control over the API code (it's the autogenerated client).
Acceptable compromises:
• Change the actual type, say be a Wrapped<ObjectsApi> that is not an ObjectsApi. (I control the caller)
• Use reflection. (Every call is an HTTP request+response, so the cost of reflection is acceptable)
Thanks!