yea, if you want an answer form an expert, you've got to become one; for those still interested, here is a working prototype: http://kenai.com/projects/guts/sources/code/show/trunk/guts-sandbox/guts-binding/src/test/java/bench/idea?rev=525
the confusion was due to guice 2.0 using INTERNAL COPY (OMG!) of cglib while I had cglib in pom as a dependency; I guess Crazy Bob did know how to use maven at the time? :-) On Sep 25, 8:48 am, Andrei Pozolotin <[email protected]> wrote: > Deepak, thanks for your feedback! > > this is exaclty what I am doing > also:http://kenai.com/projects/guts/sources/code/content/trunk/guts-sandbo... > > what I can not get is how to CALL a base class method, and NOT > overriden one? > > Andrei > > On Sep 25, 4:03 am, Deepak <[email protected]> wrote: > > > I have the same problem. Currently I am doing like this : > > > �...@override > > public Object invoke(MethodInvocation invocation) throws Throwable > > { > > > Object o = invocation.getThis(); > > AccessibleObject staticPart = invocation.getStaticPart(); > > LOGGER.debug("The root resource method {}", > > staticPart.toString()); > > > String proxyClass = o.getClass().getCanonicalName(); > > String rootResourceClass = proxyClass.substring(0, > > proxyClass.indexOf("$$")); > > LOGGER.debug("The root resource class {}", rootResourceClass); > > > return invocation.proceed(); > > } > > > On Sep 25, 12:11 am, Andrei Pozolotin <[email protected]> > > wrote: > > > > experts, your opinion, please? > > > > On Sep 23, 2:04 pm, Andrei Pozolotin <[email protected]> > > > wrote: > > > > > just to clarify why "invokeSuper" exists: > > > > > 1) > > > > >http://download-llnw.oracle.com/javase/6/docs/api/java/lang/reflect/M... > > > > > "If the underlying method is an instance method, it is invoked using > > > > dynamic method lookup as documented in The Java Language > > > > Specification, Second Edition, section 15.12.4.4; in particular, > > > > overriding based on the runtime type of the target object will occur. > > > > " > > > > > 2) > > > > >http://blogs.sun.com/sundararajan/entry/calling_overriden_superclass_... > > > > > On Sep 23, 1:50 pm, Andrei Pozolotin <[email protected]> > > > > wrote: > > > > > > not sure I follow re: two classes or two instances; > > > > > > I get only one instance of the instrumented class > > > > > Base$$EnhancerByGuice > > > > > $$ > > > > > inside the MethodInterceptor.invoke(); > > > > > > now, I get "Method call = Base.call()" via reflection; > > > > > > all that is left is to do something like this: > > > > > >http://cglib.sourceforge.net/apidocs/net/sf/cglib/MethodProxy.html#in...[]%29 > > > > > > ((MethodProxy) call).invokeSuper(instance, args) > > > > > > -- the same way guice does this internally with cglib; > > > > > > but I see no way to find the underlying MethodProxy; > > > > > > please take a look on complete working example of what I am trying to > > > > > do: > > > > > >http://kenai.com/projects/guts/sources/code/show/trunk/guts-sandbox/g... > > > > > > thank you! > > > > > > On Sep 23, 1:35 pm, Andrei Pozolotin <[email protected]> > > > > > wrote: > > > > > > > Dhanji, Sam: > > > > > > > thanks for sharing your ideas; I still can not come up with working > > > > > > example; > > > > > > > do you know if there is such piece of code anywhere? > > > > > > > Andrei > > > > > > > On Sep 22, 9:15 pm, "Dhanji R. Prasanna" <[email protected]> wrote: > > > > > > > > You could do it by binding two different instances and using an > > > > > > > instance > > > > > > > matcher. > > > > > > > > Dhanji. > > > > > > > > On Thu, Sep 23, 2010 at 12:08 PM, Sam Berlin <[email protected]> > > > > > > > wrote: > > > > > > > > This is actually a deficiency in the Binder API right now -- > > > > > > > > interceptors > > > > > > > > match based on Class (and Method), not Key. I looked into > > > > > > > > this a while ago > > > > > > > > when someone asked a similar question internally, and there > > > > > > > > didn't seem to > > > > > > > > be any reason within the implementation that it was limited to > > > > > > > > Class (as > > > > > > > > opposed to Key), but changing it to Key would be a clunky API > > > > > > > > change (it > > > > > > > > would require an additional method name... it can't be an > > > > > > > > overloaded method > > > > > > > > because the limitation on Class is in the generics, and the > > > > > > > > generic types > > > > > > > > would clash). > > > > > > > > > sam > > > > > > > > > On Wed, Sep 22, 2010 at 9:45 PM, Dhanji R. Prasanna > > > > > > > > <[email protected]>wrote: > > > > > > > > >> The simple way to do it would be to bind the class to two > > > > > > > >> different keys: > > > > > > > >> one which gets intercepted and one that doesn't. > > > > > > > > >> Dhanji. > > > > > > > > >> On Wed, Sep 22, 2010 at 7:37 AM, Andrei Pozolotin < > > > > > > > >> [email protected]> wrote: > > > > > > > > >>> Hello; > > > > > > > > >>> SITUATOIN: > > > > > > > > >>> when I use guice aop interceptor for a class: > > > > > > > > >>> class Base { void call() {} } > > > > > > > > >>> the guice aop will use cglib to produce a proxy derived > > > > > > > >>> class, such > > > > > > > >>> as: > > > > > > > > >>> class Base&&EnhancerByGuice$$12345678 extends Base { void > > > > > > > >>> call() {} } > > > > > > > > >>> PROBLEM: > > > > > > > > >>> how can I call original Base.call() method and NOT > > > > > > > >>> EnhancerByGuice? > > > > > > > > >>> in the spirit of invokeSuper(): > > > > > > > > >>>http://cglib.sourceforge.net/apidocs/net/sf/cglib/MethodProxy.html#in...[]%29 > > > > > > > > >>> Thank you; > > > > > > > > >>> Andrei > > > > > > > > >>> -- > > > > > > > >>> You received this message because you are subscribed to the > > > > > > > >>> Google Groups > > > > > > > >>> "google-guice" group. > > > > > > > >>> To post to this group, send email to > > > > > > > >>> [email protected]. > > > > > > > >>> To unsubscribe from this group, send email to > > > > > > > >>> [email protected]<google-guice%2bunsubscr...@google > > > > > > > >>> groups.com> > > > > > > > >>> . > > > > > > > >>> For more options, visit this group at > > > > > > > >>>http://groups.google.com/group/google-guice?hl=en. > > > > > > > > >> -- > > > > > > > >> You received this message because you are subscribed to the > > > > > > > >> Google Groups > > > > > > > >> "google-guice" group. > > > > > > > >> To post to this group, send email to > > > > > > > >> [email protected]. > > > > > > > >> To unsubscribe from this group, send email to > > > > > > > >> [email protected]<google-guice%2bunsubscr...@google > > > > > > > >> groups.com> > > > > > > > >> . > > > > > > > >> For more options, visit this group at > > > > > > > >>http://groups.google.com/group/google-guice?hl=en. > > > > > > > > > -- > > > > > > > > You received this message because you are subscribed to the > > > > > > > > Google Groups > > > > > > > > "google-guice" group. > > > > > > > > To post to this group, send email to > > > > > > > > [email protected]. > > > > > > > > To unsubscribe from this group, send email to > > > > > > > > [email protected]<google-guice%2bunsubscr...@google > > > > > > > > groups.com> > > > > > > > > . > > > > > > > > For more options, visit this group at > > > > > > > >http://groups.google.com/group/google-guice?hl=en. -- You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.
