* When the method is invoked, we don't immediately proceed. Intead, we return a thunk instance
* that defers its behavior to the lazily invoked invocation.
*/
public void advise(final Invocation invocation)
{
ObjectCreator deferred = new ObjectCreator()
{
public Object createObject()
{
invocation.proceed();
return invocation.getResult();
}
};
ObjectCreator cachingObjectCreator = new CachingObjectCreator(deferred);
Object thunk = thunkCreator.createThunk(thunkType, cachingObjectCreator, description);
invocation.overrideResult(thunk);
}