I\'m wondering if there is a way to specify that a method gets called in advance of a class method. I know something like this should be posssible, since JUnit has before(),
AOP does this with what are known as pointcuts AspectJ might have what you need.
Simplistically speaking, you would add before advice to your foo() method which would call init()