Skip to content

Instantly share code, notes, and snippets.

@mikebrock
Created March 12, 2013 22:56
Show Gist options
  • Select an option

  • Save mikebrock/5147866 to your computer and use it in GitHub Desktop.

Select an option

Save mikebrock/5147866 to your computer and use it in GitHub Desktop.
@CodeDecorator
public class LogCallDecorator extends IOCDecoratorExtension<LogCall> {
public LogCallDecorator(Class<LogCall> decoratesWith) {
super(decoratesWith);
}
@Override
public List<? extends Statement> generateDecorator(InjectableInstance<LogCall> ctx) {
ctx.getInjector().addInvokeBefore(ctx.getMethod(),
Stmt.invokeStatic(TestDataCollector.class, "beforeInvoke", Refs.get("a0"), Refs.get("a1")));
ctx.getInjector().addInvokeAfter(ctx.getMethod(),
Stmt.invokeStatic(TestDataCollector.class, "afterInvoke", Refs.get("a0"), Refs.get("a1")));
return Collections.emptyList();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment