Returns a method in the call stack at the given depth. Depth 0 will return the method that called this getMethodName, depth 1 the method that called it, etc... @param depth @return method name as String
(final int depth)
| 100 | * @return method name as String |
| 101 | */ |
| 102 | protected String getMethodName(final int depth) { |
| 103 | final StackTraceElement[] ste = Thread.currentThread().getStackTrace(); |
| 104 | int index; |
| 105 | if (Utils.isVendorIBM()) { |
| 106 | index = 3 + depth; |
| 107 | } else { |
| 108 | index = 2 + depth; |
| 109 | } |
| 110 | return ste[index].getMethodName(); |
| 111 | } |
| 112 | |
| 113 | } |