public Method getEnclosingMethod()
throws SecurityException
This method returns a
Method
object representing the immediately enclosing method of the this class object. If this class is not enclosed in a
method, this method returns
null
.
Examples
package com.logicbig.example.clazz;
public class GetEnclosingMethodExample {
public static void main(String[] args) { GetEnclosingMethodExample test = new GetEnclosingMethodExample(); Runnable runnable = test.getMyRunnable();