|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.philemonworks.selfdiagnose.DiagnoseUtil
public class DiagnoseUtil
Provides a set of static utility methods that are used in the setting up and running diagnostic tasks.
Constructor Summary | |
---|---|
DiagnoseUtil()
|
Method Summary | |
---|---|
static Class[] |
argumentTypesFrom(Object[] arguments)
|
static Class |
classForName(String className)
Resolve the name to a Class using the ContextClassLoader of the current thread. |
protected static Class |
detectRequestorClass()
Try to determine the class of the object that registered a DiagnosticTask by inspecting the stack frame of a locally thrown Exception. |
static URL |
findResource(String resource,
boolean useContextClassLoaderOnly)
Try finding a resource using a class loader. |
static String |
format(Date dateTime)
Use XSD datetime format without zone indication |
static String |
format(String template,
String param0)
|
static String |
format(String template,
String param0,
String param1)
|
static String |
format(String template,
String param0,
String param1,
String param2)
|
static String |
format(String template,
String param0,
String param1,
String param2,
String param3)
|
static String |
format(String template,
String param0,
String param1,
String param2,
String param3,
String param4)
|
static Connection |
getDataSourceConnection(String datasourceName)
Get a DataSource connection using JNDI. |
static String |
getErrorMessage(Exception ex)
Compose an error message from the exception and/or its causes. |
static String |
getPropertyAccessMethodName(String property)
Return the standard non-boolean getter for a property unless the property refers to the object "this". |
static Object |
newInstance(Class instanceClass,
Object[] constructorArguments)
Performs the constructing of a new instance from a Class. |
static Object |
perform(Object receiver,
String methodName)
|
static Object |
perform(Object receiver,
String methodName,
Object[] arguments)
Can invoke both instance and static methods on the receiver |
static Object |
perform(Object receiver,
String methodName,
Object[] arguments,
Class[] types)
Can invoke both instance and static methods on the receiver |
static URL |
retrieveURL(ExecutionContext ctx,
String resourceName,
String urlSpec)
|
static String |
shortName(Class someClass)
Return the unqualified name of a Java Class. |
static void |
verifyNonEmptyString(String variableName,
Object value,
Class owner)
Test that the value is a non empty String. |
static void |
verifyNotNull(String variableName,
Object value,
Class owner)
Test that the value is not null. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DiagnoseUtil()
Method Detail |
---|
public static void verifyNonEmptyString(String variableName, Object value, Class owner) throws DiagnoseException
variableName
- field name for the Taskvalue
- of the variableowner
- Task class
DiagnoseException
public static void verifyNotNull(String variableName, Object value, Class owner) throws DiagnoseException
variableName
- field name for the Taskvalue
- of the variableowner
- Task class
DiagnoseException
public static String shortName(Class someClass)
someClass
- Class
public static Object perform(Object receiver, String methodName) throws DiagnoseException
DiagnoseException
public static Object perform(Object receiver, String methodName, Object[] arguments) throws DiagnoseException
receiver
- methodName
- arguments
-
DiagnoseException
public static Object perform(Object receiver, String methodName, Object[] arguments, Class[] types) throws DiagnoseException
receiver
- methodName
- arguments
-
DiagnoseException
public static Object newInstance(Class instanceClass, Object[] constructorArguments) throws DiagnoseException
instanceClass
- constructorArguments
-
DiagnoseException
public static Class[] argumentTypesFrom(Object[] arguments)
public static Class classForName(String className) throws ClassNotFoundException
className
-
DiagnoseException
ClassNotFoundException
protected static Class detectRequestorClass()
public static Connection getDataSourceConnection(String datasourceName) throws DiagnoseException
datasourceName
- String
DiagnoseException
public static URL findResource(String resource, boolean useContextClassLoaderOnly)
resource
- StringuseContextClassLoaderOnly
- boolean
public static String format(String template, String param0)
public static String format(String template, String param0, String param1)
public static String format(String template, String param0, String param1, String param2)
public static String format(String template, String param0, String param1, String param2, String param3)
public static String format(String template, String param0, String param1, String param2, String param3, String param4)
public static String format(Date dateTime)
public static URL retrieveURL(ExecutionContext ctx, String resourceName, String urlSpec) throws Exception
Exception
public static String getPropertyAccessMethodName(String property)
property
-
public static String getErrorMessage(Exception ex)
ex
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |