org.mondemand.util

Class ClassUtils


public class ClassUtils
extends java.lang.Object

Various class utilities that are used when the user doesn't specify parameters in the API. These methods do not usually perform very well due to the need to obtain stack traces, so it is almost always preferred for the user to specify these parameters in the MonDemand API instead of trying to determine them using this class at runtime.
Author:
Michael Lum

Method Summary

static String
getCallingClass(int depth)
Returns the calling class from the depth specified.
static int
getCallingLine(int depth)
Returns the calling line number from the depth specified.
static String
getMainClass()
Returns the top-level class name.

Method Details

getCallingClass

public static String getCallingClass(int depth)
Returns the calling class from the depth specified.
Parameters:
depth - the depth to traverse in the stack
Returns:
the name of the calling class in the stack

getCallingLine

public static int getCallingLine(int depth)
Returns the calling line number from the depth specified.
Parameters:
depth - the depth to traverse in the stack
Returns:
the line number of the calling class in the stack

getMainClass

public static String getMainClass()
Returns the top-level class name. Useful when trying to determine the name of the application calling the system when it is not specified.
Returns:
the name of the top-most class in the calling stack