org.mondemand.util
Class ClassUtils

java.lang.Object
  extended by org.mondemand.util.ClassUtils

public class ClassUtils
extends 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

Constructor Summary
ClassUtils()
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassUtils

public ClassUtils()
Method Detail

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

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


Copyright © 2012. All Rights Reserved.