public final class Utils extends Object
| Modifier and Type | Method and Description | 
|---|---|
| static String | getCallingClass()Retrieves the name of the calling class. | 
| static String | getCallingClass(int level)Retrieves the name of the calling class at the specified level. | 
| static String | getCallingMethod()Retrieves the name of the calling method. | 
| static String | getCallingMethod(int level)Retrieves the name of the calling method at the specified level. | 
| static String | getClassName(Object object)Determines the name of the class of the specified object. | 
| static ClassLoader | getContextClassLoader()Determines the context class loader of the current thread if available. | 
| static String | getNameOfClass(Class c)Determines the name of the specified class. | 
| static void | logIgnoredException(String detectingClass,
                   String detectingMethod,
                   String subjectClass,
                   String subjectMethod,
                   Throwable exception)Deprecated. 
 Since XINS 2.0, use  logProgrammingError(Throwable exception) | 
| static void | logIgnoredException(Throwable exception)Logs an exception that will be ignored. | 
| static ProgrammingException | logProgrammingError(String detail)Logs a programming error with an optional cause exception, and returns a
  ProgrammingExceptionobject for it. | 
| static ProgrammingException | logProgrammingError(String detectingClass,
                   String detectingMethod,
                   String subjectClass,
                   String subjectMethod,
                   String detail)Deprecated. 
 Since XINS 2.0, use  logProgrammingError(String detail) | 
| static ProgrammingException | logProgrammingError(String detectingClass,
                   String detectingMethod,
                   String subjectClass,
                   String subjectMethod,
                   String detail,
                   Throwable cause)Deprecated. 
 Since XINS 2.0, use  logProgrammingError(String detail, Throwable cause) | 
| static ProgrammingException | logProgrammingError(String detail,
                   Throwable cause)Logs a programming error with an optional cause exception and an optional
 message, and returns a  ProgrammingExceptionobject for it. | 
| static ProgrammingException | logProgrammingError(Throwable cause)Logs a programming error with an optional cause exception, and returns a
  ProgrammingExceptionobject for it. | 
public static String getCallingClass(int level) throws IllegalArgumentException
0 indicates the direct caller, while 1
 indicates the caller of the caller.
 If it cannot be determined, then "<unknown>" is
 returned.
level - the level of the caller, must be >= 0.null.IllegalArgumentException - if level < 0.public static String getCallingClass()
"<unknown>") is returned.null.public static String getCallingMethod(int level) throws IllegalArgumentException
0 indicates the direct caller, while 1
 indicates the caller of the caller.
 If it cannot be determined, then "<unknown>" is
 returned.
level - the level of the caller, must be >= 0.null.IllegalArgumentException - if level < 0.public static String getCallingMethod()
"<unknown>") is returned.null.public static void logIgnoredException(Throwable exception) throws IllegalArgumentException
exception - the exception to log, cannot be null.IllegalArgumentException - if exception == null.public static void logIgnoredException(String detectingClass, String detectingMethod, String subjectClass, String subjectMethod, Throwable exception) throws IllegalArgumentException
logProgrammingError(Throwable exception)detectingClass - the name of the class that caught the exception, cannot be
    null.detectingMethod - the name of the method within the detectingClass that
    caught the exception, cannot be null.subjectClass - the name of the class which threw the exception, cannot be
    null.subjectMethod - the name of the method (within the subjectClass) which
    threw the exception, cannot be null.exception - the exception to log, cannot be null.IllegalArgumentException - if detectingClass == null || detectingMethod == null
          || subjectClass   == null || subjectMethod   == null
          || exception      == null.public static ProgrammingException logProgrammingError(String detail)
ProgrammingException object for it.
 The calling class/method are considered the detecting class and the caller of those (one level up) is considered the subject class/method for the programming error.
detail - the detail message, can be null.ProgrammingException that can be thrown by the
    calling method, never null.public static ProgrammingException logProgrammingError(Throwable cause)
ProgrammingException object for it.cause - the cause exception, cannot be null.ProgrammingException that can be thrown by the
    calling method, never null.public static ProgrammingException logProgrammingError(String detail, Throwable cause)
ProgrammingException object for it.detail - the detail message, can be null.cause - the cause exception, cannot be null.ProgrammingException that can be thrown by the
    calling method, never null.public static ProgrammingException logProgrammingError(String detectingClass, String detectingMethod, String subjectClass, String subjectMethod, String detail, Throwable cause)
logProgrammingError(String detail, Throwable cause)ProgrammingException object for it.detectingClass - the name of the class that detected the problem, or
    null if unknown.detectingMethod - the name of the method within the detectingClass that
    detected the problem, or null if unknown.subjectClass - the name of the class which exposes the programming error, or
    null if unknown.subjectMethod - the name of the method (within the subjectClass) which
    exposes the programming error, or null if unknown.detail - the detail message, can be null.cause - the cause exception, can be null.ProgrammingException that can be thrown by the
    calling method, never null.public static ProgrammingException logProgrammingError(String detectingClass, String detectingMethod, String subjectClass, String subjectMethod, String detail)
logProgrammingError(String detail)ProgrammingException object for it.detectingClass - the name of the class that detected the problem, or
    null if unknown.detectingMethod - the name of the method within the detectingClass that
    detected the problem, or null if unknown.subjectClass - the name of the class which exposes the programming error, or
    null if unknown.subjectMethod - the name of the method (within the subjectClass) which
    exposes the programming error, or null if unknown.detail - the detail message, can be null.ProgrammingException that can be thrown by the
    calling method, never null.public static String getNameOfClass(Class c) throws IllegalArgumentException
c - the class to determine the name for, not null.null.IllegalArgumentException - if c == null.public static String getClassName(Object object) throws IllegalArgumentException
object - the object to determine the name of the class for, not
    null.null.IllegalArgumentException - if object == null.public static ClassLoader getContextClassLoader()
null.See http://www.xins.org/.