Package org.wildfly.security.manager
Class StackInspector
java.lang.Object
org.wildfly.security.manager.StackInspector
A utility class which is useful for inspecting the call stack.
- Author:
- David M. Lloyd
-
Method Summary
Modifier and TypeMethodDescriptionbooleancallStackContains(Class<?> clazz) Determine whether the call stack contains a given class.Class<?>getCallerClass(int skipFrames) Get the caller class.Class<?>[]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 StackInspectorGet the singletonStackInspectorinstance.
-
Method Details
-
getInstance
Get the singletonStackInspectorinstance. The caller must have thegetStackInspectorRuntimePermission. If the security manager is enabled, requiresgetStackInspectorWildFlySecurityManagerPermission.- Returns:
- the singleton
StackInspectorinstance
-
getCallerClass
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
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
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
Get the call stack.- Returns:
- the call stack
-
callStackContains
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
-