Due to performance issues it would be great if it would be possible to register a MethodFilter. Only methods that are accepted by this filter will be wrapped by the proxy generator.
Discussion
Anonymous
-
2008-06-26
Logged In: YES
user_id=2077867
Originator: NO
So something like the net.sf.cglib.proxy.CallbackFilter, only applied during code generation?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You are right. i want only to generate a proxy that implements a set of methods of the source class. Gettings invoked for all methods that are exposed by the source source class will result in a unacceptable performance loss (e.g. i do not care about toString(), hashCode(), ...)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2008-07-03
Logged In: YES
user_id=2077867
Originator: NO
I didn't realize it at the time, but my question was a trick question. CallbackFilter *does* apply to code generation. The accept(Method) method returns an int, which corresponds to an index of the Callback[] that you can provide to the Enhancer. If you don't want anything to be done for certain methods, make one of the Callback instances a NoOp, and have your CallbackFilter return the index of this NoOp instance as it appears in your Callback[]. The other elements of your Callback[] will be applied when your CallbackFilter returns their indeces for the given method.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would like add a real feature request based on 2.1 version, may be it's already fixed in 2.2 :)
If CallbackFilter returns NoOp as a result, CGLib should not even override super method. Thus, instead of Interceptor>Interceptor>Super call it should just use super class, and CGLib enhanced proxy should not even appear in stack trace.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=2077867
Originator: NO
So something like the net.sf.cglib.proxy.CallbackFilter, only applied during code generation?
Logged In: NO
You are right. i want only to generate a proxy that implements a set of methods of the source class. Gettings invoked for all methods that are exposed by the source source class will result in a unacceptable performance loss (e.g. i do not care about toString(), hashCode(), ...)
Logged In: YES
user_id=2077867
Originator: NO
I didn't realize it at the time, but my question was a trick question. CallbackFilter *does* apply to code generation. The accept(Method) method returns an int, which corresponds to an index of the Callback[] that you can provide to the Enhancer. If you don't want anything to be done for certain methods, make one of the Callback instances a NoOp, and have your CallbackFilter return the index of this NoOp instance as it appears in your Callback[]. The other elements of your Callback[] will be applied when your CallbackFilter returns their indeces for the given method.
I would like add a real feature request based on 2.1 version, may be it's already fixed in 2.2 :)
If CallbackFilter returns NoOp as a result, CGLib should not even override super method. Thus, instead of Interceptor>Interceptor>Super call it should just use super class, and CGLib enhanced proxy should not even appear in stack trace.