I though I’d do something different this time. Instead of describing something technical, I have recorded a five minute video that shows a very neat trick in Java: How to create a bit of code that wraps existing method calls to an object with any behavior you may desire.
This is nothing new, but I’ve noticed that not many developers know how to use it, so I hope this video may be useful:
If you would rather not include a library like cglib in your code and you don’t mind having to create an interface to create this sort of code, you can do the same with
Copyright © 2010 Johannes Brodwall. All Rights Reserved.