|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.groovy.reflection.ReflectionUtils
public class ReflectionUtils
This class contains utility methods to determine which class called the current class to multiple levels of depth. Calls used to handle the groovy MOP are excluded from the level counting.
Field Summary | |
---|---|
private static java.util.Set<java.lang.String> |
ignoredPackages
|
private static java.lang.reflect.Method |
magicMethod
|
Constructor Summary | |
---|---|
ReflectionUtils()
|
Method Summary | |
---|---|
private static boolean |
classShouldBeIgnored(java.lang.Class c,
java.util.Collection<java.lang.String> extraIgnoredPackages)
|
static java.lang.Class |
getCallingClass()
Get the immediate calling class, ignoring MOP frames. |
static java.lang.Class |
getCallingClass(int matchLevel)
Get the called that is matchLevel stack frames before the call, ignoring MOP frames. |
static java.lang.Class |
getCallingClass(int matchLevel,
java.util.Collection<java.lang.String> extraIgnoredPackages)
Get the called that is matchLevel stack frames before the call, ignoring MOP frames and desired exclude packages. |
static boolean |
isCallingClassReflectionAvailable()
Determine whether or not the getCallingClass methods will return any sensible results. |
private static boolean |
superClassShouldBeIgnored(java.lang.Class sc)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.util.Set<java.lang.String> ignoredPackages
private static final java.lang.reflect.Method magicMethod
Constructor Detail |
---|
public ReflectionUtils()
Method Detail |
---|
public static boolean isCallingClassReflectionAvailable()
public static java.lang.Class getCallingClass()
public static java.lang.Class getCallingClass(int matchLevel)
matchLevel
- how may call stacks down to look.
If it is less than 1 it is treated as though it was 1.
public static java.lang.Class getCallingClass(int matchLevel, java.util.Collection<java.lang.String> extraIgnoredPackages)
matchLevel
- how may call stacks down to look.
If it is less than 1 it is treated as though it was 1.extraIgnoredPackages
- A collection of string names of packages to exclude
in addition to the MOP packages when counting stack frames.
private static boolean superClassShouldBeIgnored(java.lang.Class sc)
private static boolean classShouldBeIgnored(java.lang.Class c, java.util.Collection<java.lang.String> extraIgnoredPackages)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |