@Override protected Object getTarget(MethodInvocation invocation) { return invocation.getInstance(); }
public void advise(MethodInvocation invocation) { ComponentResources resources = invocation.getInstanceContext().get(ComponentResources.class); Binding binding = bindingSource.newBinding("@Cached watch", resources, BindingConstants.PROP, watch); bindingFieldHandle.set(invocation.getInstance(), binding); invocation.proceed(); } });
@Override protected Object getTarget(MethodInvocation invocation) { return invocation.getInstance(); }
public void run() { Component instance = (Component) invocation.getInstance(); handler.handleEvent(instance, event); } });
@Override protected Class<?> getTargetClass(MethodInvocation invocation) { final Object instance = invocation.getInstance(); Class<?> clasz = instance.getClass(); // Here be dragons . . . if (SERVICE_PROXY_CLASS_NAME.matcher(clasz.getName()).matches()) { clasz = getDelegateType(instance); } return clasz; }
public void advise(MethodInvocation invocation) { invocation.proceed(); Object instance = invocation.getInstance(); for (MethodHandle handle : handles) { handle.invoke(instance); } } });
public void advise(MethodInvocation invocation) { invocation.proceed(); handle.invoke(invocation.getInstance()).rethrow(); } };
public void advise(MethodInvocation invocation) { invocation.proceed(); Asset[] assets = (Asset[]) access.get(invocation.getInstance()); F.flow(assets).each(operation); } });
private MethodResultCache getOrCreateCache(MethodInvocation invocation) { Object instance = invocation.getInstance(); // The PerThreadValue is created in the instance constructor. PerThreadValue<MethodResultCache> value = (PerThreadValue<MethodResultCache>) fieldHandle .get(instance); // But it will be empty when first created, or at the start of a new request. if (value.exists()) { return value.get(); } // Use the factory to create a MethodResultCache for the combination of instance, method, and thread. return value.set(factory.create(instance)); } };