I want to write a java annotation which times the method call. something like this:
@TimeIt
public int someMethod() { ... }
and when this m
As of 2016, there's a nifty aspect annotation library jcabi-aspects.
From the docs:
Annotate your methods with @Loggable annotation and every time they are called, your SLF4J logging facility will receive a message with the details of execution and the total execution time:
public class Resource {
@Loggable(Loggable.DEBUG)
public String load(URL url) {
return url.openConnection().getContent();
}
}
Something like this will appear in the log:
[DEBUG] #load('http://www.google.com'): returned "
Read more about @Loggable here.