transformation.getOrCreateMethod(TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE).addAdvice(
new ComponentMethodAdvice()
{
public void advise(ComponentMethodInvocation invocation)
{
Binding binding = bindingSource.newBinding("@Cached watch", invocation.getComponentResources(),
BindingConstants.PROP, watch);
bindingAccess.write(invocation.getInstance(), binding);
invocation.proceed();
}
});
return new MethodResultCacheFactory()
{
public MethodResultCache create(Component instance)
{
Binding binding = (Binding) bindingAccess.read(instance);
return new WatchedBindingMethodResultCache(binding);
}
};
}