|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xins.common.Utils
General utility functions.
Method Summary | |
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 double |
getJavaVersion()
Retrieves the actual (major) Java version. |
static String |
getNameOfClass(Class c)
Determines the name of the specified class. |
static void |
logIgnoredException(String detectingClass,
String detectingMethod,
String subjectClass,
String subjectMethod,
String detail,
Throwable exception)
Logs an exception that will be ignored, with the specified detail message. |
static void |
logIgnoredException(String detectingClass,
String detectingMethod,
String subjectClass,
String subjectMethod,
Throwable exception)
Logs an exception that will be ignored. |
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 ProgrammingException object for it. |
static ProgrammingException |
logProgrammingError(String detectingClass,
String detectingMethod,
String subjectClass,
String subjectMethod,
String detail)
Logs a programming error with no cause exception, and returns a ProgrammingException object for it. |
static ProgrammingException |
logProgrammingError(String detectingClass,
String detectingMethod,
String subjectClass,
String subjectMethod,
String detail,
Throwable cause)
Logs a programming error with an optional cause exception, and returns a ProgrammingException object for it. |
static ProgrammingException |
logProgrammingError(Throwable cause)
Logs a programming error with an optional cause exception, and returns a ProgrammingException object for it. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static double getJavaVersion()
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(String detectingClass, String detectingMethod, String subjectClass, String subjectMethod, String detail, Throwable exception) throws IllegalArgumentException
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
.detail
- detail message, can be null
.exception
- the exception to log, cannot be null
.
IllegalArgumentException
- if detectingClass == null || detectingMethod == null
|| subjectClass == null || subjectMethod == null
|| exception == 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
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 detectingClass, String detectingMethod, String subjectClass, String subjectMethod, 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)
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
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |