|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.twelvemonkeys.lang.SystemUtil
public final class SystemUtil
A utility class with some useful system-related functions.
NOTE: This class is not considered part of the public API and may be changed without notice
| Field Summary | |
|---|---|
static String |
STD_PROPERTIES
".properties" |
static String |
XML_PROPERTIES
".xml" |
| Method Summary | |
|---|---|
static Object |
clone(Cloneable pObject)
|
static boolean |
isClassAvailable(String pClassName)
Tests if a named class is generally available. |
static boolean |
isClassAvailable(String pClassName,
Class pFromClass)
Tests if a named class is available from another class. |
static boolean |
isFieldAvailable(String pClassName,
String pFieldName)
|
static boolean |
isFieldAvailable(String pClassName,
String pFieldName,
Class pFromClass)
|
static boolean |
isMethodAvailable(String pClassName,
String pMethodName)
|
static boolean |
isMethodAvailable(String pClassName,
String pMethodName,
Class[] pParams)
|
static boolean |
isMethodAvailable(String pClassName,
String pMethodName,
Class[] pParams,
Class pFromClass)
|
static Properties |
loadProperties(Class pClass)
Utility method for loading a properties-file for a given class. |
static Properties |
loadProperties(Class pClass,
String pName)
Utility method for loading a named properties-file for a class. |
static Properties |
loadProperties(String pName)
Utility method for loading a named properties-file. |
static void |
main(String[] args)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static String XML_PROPERTIES
".xml"
public static String STD_PROPERTIES
".properties"
| Method Detail |
|---|
public static Properties loadProperties(Class pClass,
String pName)
throws IOException
The properties-file is loaded through either:
Both normal java.util.Properties and com.twelvemonkeys.util.XMLProperties are supported (XML-properties must have ".xml" as its file extension).
pClass - The class to load properties for. If this parameter is
null, the method will work exactly as
loadProperties(String)pName - The name of the properties-file. If this parameter is
null, the method will work exactly as
loadProperties(Class)
NullPointerException - if both pName and
pClass paramters are null
IOException - if an error occurs during load.
FileNotFoundException - if no properties-file could be found.loadProperties(String),
loadProperties(Class),
ClassLoader.getResourceAsStream(java.lang.String),
ClassLoader.getSystemResourceAsStream(java.lang.String)
public static Properties loadProperties(Class pClass)
throws IOException
The properties-file is loaded through either:
Both normal java.util.Properties and com.twelvemonkeys.util.XMLProperties are supported (XML-properties must have ".xml" as its file extension).
pClass - The class to load properties for
NullPointerException - if the pClass paramters is
null
IOException - if an error occurs during load.
FileNotFoundException - if no properties-file could be found.loadProperties(String),
loadProperties(Class, String),
ClassLoader.getResourceAsStream(java.lang.String),
ClassLoader.getSystemResourceAsStream(java.lang.String)
public static Properties loadProperties(String pName)
throws IOException
The properties-file is loaded through either:
Both normal java.util.Properties and com.twelvemonkeys.util.XMLProperties are supported (XML-properties must have ".xml" as its file extension).
pName - The name of the properties-file.
NullPointerException - if the pName paramters is
null
IOException - if an error occurs during load.
FileNotFoundException - if no properties-file could be found.loadProperties(Class),
loadProperties(Class, String),
ClassLoader.getSystemResourceAsStream(java.lang.String)
public static Object clone(Cloneable pObject)
throws CloneNotSupportedException
CloneNotSupportedException
public static void main(String[] args)
throws CloneNotSupportedException
CloneNotSupportedExceptionpublic static boolean isClassAvailable(String pClassName)
Class.forName(pClassName) will not result in an exception.
pClassName - the class name to test
true if available
public static boolean isClassAvailable(String pClassName,
Class pFromClass)
Class.forName(pClassName, true, pFromClass.getClassLoader())
will not result in an exception.
pClassName - the class name to testpFromClass - the class to test from
true if available
public static boolean isFieldAvailable(String pClassName,
String pFieldName)
public static boolean isFieldAvailable(String pClassName,
String pFieldName,
Class pFromClass)
public static boolean isMethodAvailable(String pClassName,
String pMethodName)
public static boolean isMethodAvailable(String pClassName,
String pMethodName,
Class[] pParams)
public static boolean isMethodAvailable(String pClassName,
String pMethodName,
Class[] pParams,
Class pFromClass)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||