I found an interesting technique (I think) on the web and I'm tailoring it to fit my needs.
I've created an abstract class called TraceProxy which implements java.lang.reflect.InvocationHandler. The idea being that a child of this class will define two methods, before() and after() to add pre/post processing to the invoked object's method calls.
I'm doing this to eventually track performance of my JDBC method calls, but I'd like it to be able to enable this for any method in any object.
Anyways, it works great but I'd like it to handle generic types (well, without any warnings).
My abstract class:
My child class:
For the following code, I'm receiving a warning that the case is checking against the erased type Map. So I guess the type is being stripped away?
I believe I've shown all pertinent sections, is my generic code wrong? Or perhaps it's not possible to maintain the type since it's been converted to a proxy?
I'm still working out how things work with generics in my head so any help is appreciated!
Thanks, Bill G.
Increasingly, people seem to misinterpret complexity as sophistication, which is baffling - the incomprehensible should cause suspicion rather than admiration. Possibly this trend results from a mistaken belief that using a somewhat mysterious device confers an aura of power on the user. Niklaus Wirth
Joined: Dec 21, 2004
Sorry, copied wrong section for last example. Should be:
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com