patterntesting.runtime.util
Class StackTraceScanner

Package class diagram package StackTraceScanner
java.lang.Object
  extended by patterntesting.runtime.util.StackTraceScanner

public final class StackTraceScanner
extends Object

This class allows you to scan the stacktrace for different stuff.

Since:
1.4.1 (24.01.2014)
Author:
oliver

Method Summary
static StackTraceElement find(Class<?> clazz, Method method)
          Find the given method on the stack trace.
static StackTraceElement find(Class<?> clazz, String methodName)
          Find the given method on the stack trace.
static StackTraceElement find(Signature signature)
          Find the given signature on the stack trace.
static StackTraceElement find(String classname, String methodName)
          Find the given method on the stack trace.
static StackTraceElement findConstructor(Class<?> clazz)
          Find the constructor of the given class on the stack trace.
static Class<?> getCallerClass()
          Gets the caller class by examing the stacktrace.
static Class<?> getCallerClass(Pattern... excluded)
          Gets the caller class by examing the stacktrace.
static Class<?> getCallerClass(Pattern[] excludedMethods, Class<?>... excludedClasses)
          Gets the caller class by examing the stacktrace.
static StackTraceElement getCallerOf(Class<?> clazz, Method method)
          Gets the caller of the given method.
static StackTraceElement getCallerOf(Class<?> clazz, Method method, Pattern... excluded)
          Gets the caller of the given method.
static StackTraceElement getCallerOf(Class<?> clazz, String methodName)
          Gets the caller of the given method.
static StackTraceElement getCallerOf(Class<?> clazz, String methodName, Pattern... excluded)
          Gets the caller of the given method.
static StackTraceElement getCallerOf(Signature signature)
          Gets the caller of the given signature.
static StackTraceElement getCallerOf(Signature signature, Pattern... excluded)
          Gets the caller of the given signature.
static StackTraceElement getCallerOf(String classname, String methodName)
          Gets the caller of the given method.
static StackTraceElement getCallerOf(String classname, String methodName, Pattern... excluded)
          Gets the caller of the given method.
static StackTraceElement getCallerOfConstructor(Class<?> clazz)
          Gets the caller of a constructor.
static StackTraceElement getCallerOfConstructor(Class<?> clazz, Pattern... excluded)
          Gets the caller of a constructor.
static StackTraceElement[] getCallerStackTrace()
          Gets the caller stack trace of the method or constructor which calls it.
static StackTraceElement[] getCallerStackTrace(Pattern... excluded)
          Gets the caller stack trace of the method or constructor which calls it.
static StackTraceElement[] getCallerStackTrace(Pattern[] excludedMethods, Class<?>... excludedClasses)
          Gets the caller stack trace of the method or constructor which calls it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

findConstructor

public static StackTraceElement findConstructor(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 StackTraceElement find(Signature signature)
Find the given signature on the stack trace.

Parameters:
signature - the signature
Returns:
the stack trace element

find

public static StackTraceElement find(Class<?> clazz,
                                     Method method)
Find the given method on the stack trace.

Parameters:
clazz - the clazz
method - the method
Returns:
the stack trace element

find

public static StackTraceElement find(Class<?> clazz,
                                     String methodName)
Find the given method on the stack trace.

Parameters:
clazz - the clazz
methodName - the method name
Returns:
the stack trace element

find

public static StackTraceElement find(String classname,
                                     String methodName)
Find the given method on the stack trace.

Parameters:
classname - the classname
methodName - the method name
Returns:
the stack trace element

getCallerOfConstructor

public static StackTraceElement getCallerOfConstructor(Class<?> clazz)
Gets the caller of a constructor.

Parameters:
clazz - the clazz
Returns:
the caller of constructor

getCallerOfConstructor

public static StackTraceElement getCallerOfConstructor(Class<?> clazz,
                                                       Pattern... excluded)
Gets the caller of a constructor.

Parameters:
clazz - the clazz
excluded - the excluded
Returns:
the caller of constructor

getCallerOf

public static StackTraceElement getCallerOf(Signature signature)
Gets the caller of the given signature.

Parameters:
signature - the signature
Returns:
the caller of

getCallerOf

public static StackTraceElement getCallerOf(Class<?> clazz,
                                            Method method)
Gets the caller of the given method.

Parameters:
clazz - the clazz
method - the method
Returns:
the caller of

getCallerOf

public static StackTraceElement getCallerOf(Class<?> clazz,
                                            String methodName)
Gets the caller of the given method.

Parameters:
clazz - the clazz
methodName - the method name
Returns:
the caller of

getCallerOf

public static StackTraceElement getCallerOf(String classname,
                                            String methodName)
Gets the caller of the given method.

Parameters:
classname - the classname
methodName - the method name
Returns:
the caller of

getCallerOf

public static StackTraceElement getCallerOf(Signature signature,
                                            Pattern... excluded)
Gets the caller of the given signature.

Parameters:
signature - the signature
excluded - the excluded
Returns:
the caller of

getCallerOf

public static StackTraceElement getCallerOf(Class<?> clazz,
                                            Method method,
                                            Pattern... excluded)
Gets the caller of the given method.

Parameters:
clazz - the clazz
method - the method
excluded - a list of filters which should be not considered as caller
Returns:
the caller of

getCallerOf

public static StackTraceElement getCallerOf(Class<?> clazz,
                                            String methodName,
                                            Pattern... excluded)
Gets the caller of the given method.

Parameters:
clazz - the clazz
methodName - the method name
excluded - a list of filters which should be not considered as caller
Returns:
the caller of

getCallerOf

public static StackTraceElement getCallerOf(String classname,
                                            String methodName,
                                            Pattern... excluded)
Gets the caller of the given method.

Parameters:
classname - the classname
methodName - the method name
excluded - a list of filters which should be not considered as caller
Returns:
the caller of

getCallerClass

public static Class<?> getCallerClass()
Gets the caller class by examing the stacktrace.

Returns:
the caller class

getCallerClass

public static Class<?> getCallerClass(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 Class<?> getCallerClass(Pattern[] excludedMethods,
                                      Class<?>... excludedClasses)
Gets the caller class by examing the stacktrace.

Parameters:
excludedMethods - the excluded methods
excludedClasses - the excluded classes
Returns:
the caller class

getCallerStackTrace

public static 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 StackTraceElement[] getCallerStackTrace(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 StackTraceElement[] getCallerStackTrace(Pattern[] excludedMethods,
                                                      Class<?>... excludedClasses)
Gets the caller stack trace of the method or constructor which calls it.

Parameters:
excludedMethods - the excluded methods
excludedClasses - the excluded classes
Returns:
the caller stack trace
Since:
1.4.2 (17.05.2014)


Copyright © 2002–2014 PatternTesting Team. All rights reserved.