title: Writing a java annotation for timing method call
body: <p>I want to write a java annotation which times the method call. something like this:</p>
  
  <pre><code>@TimeIt
  public int someMethod() { ... }
  </code></pre>
  
  <p>and when this method is invoked, it should output on console how long this method took</p>
  
  <p>I know how to do it in python, this is what I want it to do:</p>
  
  <pre><code>from time import time, sleep
  
  def time_it(func):
      def wrapper(*args, **kwargs):
          start = time()
          func(*args, **kwargs)
          stop = time()
          print "The function", func.__name__, " took %.3f" % (stop - start)
      wrapper.__name__ = func.__name__
      return wrapper
  
  @time_it
  def print_something(*args, **kwargs):
      print "before sleeping"
      print args, kwargs
      sleep(3) # wait 3 seconds
      print "after sleeping"
  
  print_something(1, 2, 3, a="what is this?")
  </code></pre>
  
  <p>So my questions are?
  Where do I find some documentation to write something like this, I tried <a href="http://download.oracle.com/javase/1.5.0/docs/guide/apt/GettingStarted.html#AnnotationProcessor" rel="noreferrer"><code>apt</code></a> documentation, had no luck with it.
  can someone help with writing something like this?</p>