Package org.wildfly.security.manager
Class StackInspector
- java.lang.Object
 - 
- org.wildfly.security.manager.StackInspector
 
 
- 
public final class StackInspector extends Object
A utility class which is useful for inspecting the call stack.- Author:
 - David M. Lloyd
 
 
- 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancallStackContains(Class<?> clazz)Determine whether the call stack contains a given class.Class<?>getCallerClass(int skipFrames)Get the caller class.Class<?>[]getCallStack()Get the call stack.Class<?>[]getCallStack(int skipFrames)Get all or a portion of the call stack.Class<?>[]getCallStack(int skipFrames, int numFrames)Get all or a portion of the call stack.static StackInspectorgetInstance()Get the singletonStackInspectorinstance. 
 - 
 
- 
- 
Method Detail
- 
getInstance
public static StackInspector getInstance()
Get the singletonStackInspectorinstance. The caller must have thegetStackInspectorRuntimePermission. If the security manager is enabled, requiresgetStackInspectorWildFlySecurityManagerPermission.- Returns:
 - the singleton 
StackInspectorinstance 
 
- 
getCallerClass
public Class<?> getCallerClass(int skipFrames)
Get the caller class. TheskipFramesargument specifies how many spots to go back on the call stack; 0 indicates the immediate caller.- Parameters:
 skipFrames- the number of frames to skip over before the immediate caller- Returns:
 - the caller class
 
 
- 
getCallStack
public Class<?>[] getCallStack(int skipFrames, int numFrames)
Get all or a portion of the call stack. ThenumFramesargument specifies how many frames should be returned.- Parameters:
 skipFrames- the number of frames to skip; 0 will include the immediate caller at index 0numFrames- the maximum number of frames to return- Returns:
 - the partial call stack
 
 
- 
getCallStack
public Class<?>[] getCallStack(int skipFrames)
Get all or a portion of the call stack. ThenumFramesargument specifies how many frames should be returned.- Parameters:
 skipFrames- the number of frames to skip; 0 will include the immediate caller at index 0- Returns:
 - the partial call stack
 
 
- 
getCallStack
public Class<?>[] getCallStack()
Get the call stack.- Returns:
 - the call stack
 
 
- 
callStackContains
public boolean callStackContains(Class<?> clazz)
Determine whether the call stack contains a given class. Useful for assertions.- Parameters:
 clazz- the class to test- Returns:
 trueif the call stack contains the class
 
 - 
 
 -