Package patterntesting.runtime.util
Class StackTraceScanner
- java.lang.Object
-
- patterntesting.runtime.util.StackTraceScanner
-
public final class StackTraceScanner extends java.lang.Object
This class allows you to scan the stacktrace for different stuff.- Since:
- 1.4.1 (24.01.2014)
- Author:
- oliver
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StackTraceElement
find(java.lang.Class<?> clazz, java.lang.reflect.Method method)
Find the given method on the stack trace.static java.lang.StackTraceElement
find(java.lang.Class<?> clazz, java.lang.String methodName)
Find the given method on the stack trace.static java.lang.StackTraceElement
find(java.lang.String classname, java.lang.String methodName)
Find the given method on the stack trace.static java.lang.StackTraceElement
find(org.aspectj.lang.Signature signature)
Find the given signature on the stack trace.static java.lang.StackTraceElement
findConstructor(java.lang.Class<?> clazz)
Find the constructor of the given class on the stack trace.static java.lang.Class<?>
getCallerClass()
Gets the caller class by examing the stacktrace.static java.lang.Class<?>
getCallerClass(java.util.regex.Pattern... excluded)
Gets the caller class by examing the stacktrace.static java.lang.Class<?>
getCallerClass(java.util.regex.Pattern[] excludedMethods, java.lang.Class<?>... excludedClasses)
Gets the caller class by examing the stacktrace.static java.lang.StackTraceElement
getCallerOf(java.lang.Class<?> clazz, java.lang.reflect.Method method)
Gets the caller of the given method.static java.lang.StackTraceElement
getCallerOf(java.lang.Class<?> clazz, java.lang.reflect.Method method, java.util.regex.Pattern... excluded)
Gets the caller of the given method.static java.lang.StackTraceElement
getCallerOf(java.lang.Class<?> clazz, java.lang.String methodName)
Gets the caller of the given method.static java.lang.StackTraceElement
getCallerOf(java.lang.Class<?> clazz, java.lang.String methodName, java.util.regex.Pattern... excluded)
Gets the caller of the given method.static java.lang.StackTraceElement
getCallerOf(java.lang.String classname, java.lang.String methodName)
Gets the caller of the given method.static java.lang.StackTraceElement
getCallerOf(java.lang.String classname, java.lang.String methodName, java.util.regex.Pattern... excluded)
Gets the caller of the given method.static java.lang.StackTraceElement
getCallerOf(org.aspectj.lang.Signature signature)
Gets the caller of the given signature.static java.lang.StackTraceElement
getCallerOf(org.aspectj.lang.Signature signature, java.util.regex.Pattern... excluded)
Gets the caller of the given signature.static java.lang.StackTraceElement
getCallerOfConstructor(java.lang.Class<?> clazz)
Gets the caller of a constructor.static java.lang.StackTraceElement
getCallerOfConstructor(java.lang.Class<?> clazz, java.util.regex.Pattern... excluded)
Gets the caller of a constructor.static java.lang.StackTraceElement[]
getCallerStackTrace()
Gets the caller stack trace of the method or constructor which calls it.static java.lang.StackTraceElement[]
getCallerStackTrace(java.util.regex.Pattern... excluded)
Gets the caller stack trace of the method or constructor which calls it.static java.lang.StackTraceElement[]
getCallerStackTrace(java.util.regex.Pattern[] excludedMethods, java.lang.Class<?>... excludedClasses)
Gets the caller stack trace of the method or constructor which calls it.
-
-
-
Method Detail
-
findConstructor
public static java.lang.StackTraceElement findConstructor(java.lang.Class<?> clazz)
Find the constructor of the given class on the stack trace.- Parameters:
clazz
- the clazz- Returns:
- the stack trace element
-
find
public static java.lang.StackTraceElement find(org.aspectj.lang.Signature signature)
Find the given signature on the stack trace.- Parameters:
signature
- the signature- Returns:
- the stack trace element
-
find
public static java.lang.StackTraceElement find(java.lang.Class<?> clazz, java.lang.reflect.Method method)
Find the given method on the stack trace.- Parameters:
clazz
- the clazzmethod
- the method- Returns:
- the stack trace element
-
find
public static java.lang.StackTraceElement find(java.lang.Class<?> clazz, java.lang.String methodName)
Find the given method on the stack trace.- Parameters:
clazz
- the clazzmethodName
- the method name- Returns:
- the stack trace element
-
find
public static java.lang.StackTraceElement find(java.lang.String classname, java.lang.String methodName)
Find the given method on the stack trace.- Parameters:
classname
- the classnamemethodName
- the method name- Returns:
- the stack trace element
-
getCallerOfConstructor
public static java.lang.StackTraceElement getCallerOfConstructor(java.lang.Class<?> clazz)
Gets the caller of a constructor.- Parameters:
clazz
- the clazz- Returns:
- the caller of constructor
-
getCallerOfConstructor
public static java.lang.StackTraceElement getCallerOfConstructor(java.lang.Class<?> clazz, java.util.regex.Pattern... excluded)
Gets the caller of a constructor.- Parameters:
clazz
- the clazzexcluded
- the excluded- Returns:
- the caller of constructor
-
getCallerOf
public static java.lang.StackTraceElement getCallerOf(org.aspectj.lang.Signature signature)
Gets the caller of the given signature.- Parameters:
signature
- the signature- Returns:
- the caller of
-
getCallerOf
public static java.lang.StackTraceElement getCallerOf(java.lang.Class<?> clazz, java.lang.reflect.Method method)
Gets the caller of the given method.- Parameters:
clazz
- the clazzmethod
- the method- Returns:
- the caller of
-
getCallerOf
public static java.lang.StackTraceElement getCallerOf(java.lang.Class<?> clazz, java.lang.String methodName)
Gets the caller of the given method.- Parameters:
clazz
- the clazzmethodName
- the method name- Returns:
- the caller of
-
getCallerOf
public static java.lang.StackTraceElement getCallerOf(java.lang.String classname, java.lang.String methodName)
Gets the caller of the given method.- Parameters:
classname
- the classnamemethodName
- the method name- Returns:
- the caller of
-
getCallerOf
public static java.lang.StackTraceElement getCallerOf(org.aspectj.lang.Signature signature, java.util.regex.Pattern... excluded)
Gets the caller of the given signature.- Parameters:
signature
- the signatureexcluded
- the excluded- Returns:
- the caller of
-
getCallerOf
public static java.lang.StackTraceElement getCallerOf(java.lang.Class<?> clazz, java.lang.reflect.Method method, java.util.regex.Pattern... excluded)
Gets the caller of the given method.- Parameters:
clazz
- the clazzmethod
- the methodexcluded
- a list of filters which should be not considered as caller- Returns:
- the caller of
-
getCallerOf
public static java.lang.StackTraceElement getCallerOf(java.lang.Class<?> clazz, java.lang.String methodName, java.util.regex.Pattern... excluded)
Gets the caller of the given method.- Parameters:
clazz
- the clazzmethodName
- the method nameexcluded
- a list of filters which should be not considered as caller- Returns:
- the caller of
-
getCallerOf
public static java.lang.StackTraceElement getCallerOf(java.lang.String classname, java.lang.String methodName, java.util.regex.Pattern... excluded)
Gets the caller of the given method.- Parameters:
classname
- the classnamemethodName
- the method nameexcluded
- a list of filters which should be not considered as caller- Returns:
- the caller of
-
getCallerClass
public static java.lang.Class<?> getCallerClass()
Gets the caller class by examing the stacktrace.- Returns:
- the caller class
-
getCallerClass
public static java.lang.Class<?> getCallerClass(java.util.regex.Pattern... excluded)
Gets the caller class by examing the stacktrace.- Parameters:
excluded
- a list of filters which should be not considered as caller- Returns:
- the caller of
-
getCallerClass
public static java.lang.Class<?> getCallerClass(java.util.regex.Pattern[] excludedMethods, java.lang.Class<?>... excludedClasses)
Gets the caller class by examing the stacktrace.- Parameters:
excludedMethods
- the excluded methodsexcludedClasses
- the excluded classes- Returns:
- the caller class
-
getCallerStackTrace
public static java.lang.StackTraceElement[] getCallerStackTrace()
Gets the caller stack trace of the method or constructor which calls it.- Returns:
- the caller stack trace
- Since:
- 1.4.2 (17.05.2014)
-
getCallerStackTrace
public static java.lang.StackTraceElement[] getCallerStackTrace(java.util.regex.Pattern... excluded)
Gets the caller stack trace of the method or constructor which calls it.- Parameters:
excluded
- a list of filters which should be not considered as caller- Returns:
- the caller stack trace
- Since:
- 1.4.2 (17.05.2014)
-
getCallerStackTrace
public static java.lang.StackTraceElement[] getCallerStackTrace(java.util.regex.Pattern[] excludedMethods, java.lang.Class<?>... excludedClasses)
Gets the caller stack trace of the method or constructor which calls it.- Parameters:
excludedMethods
- the excluded methodsexcludedClasses
- the excluded classes- Returns:
- the caller stack trace
- Since:
- 1.4.2 (17.05.2014)
-
-