Reflection Java Book

Constructor
getEnclosingConstructor() If this Class object represents a local or anonymous class within a constructor, returns a Constructor object representing the immediately enclosing constructor of the underlying class.
Method getEnclosingMethod()
If this Class object represents a local or anonymous class within a method, returns a Method object representing the immediately enclosing method of the underlying class