public final class SystemUtil extends Object
Modifier and Type | Field | Description |
---|---|---|
static String |
STD_PROPERTIES |
".properties" |
static String |
XML_PROPERTIES |
".xml" |
Modifier and Type | Method | Description |
---|---|---|
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) |
public static String XML_PROPERTIES
".xml"
public static String STD_PROPERTIES
".properties"
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 forNullPointerException
- 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
CloneNotSupportedException
public static boolean isClassAvailable(String pClassName)
Class.forName(pClassName)
will not result in an exception.pClassName
- the class name to testtrue
if availablepublic 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 fromtrue
if availablepublic static boolean isFieldAvailable(String pClassName, String pFieldName, Class pFromClass)
public static boolean isMethodAvailable(String pClassName, String pMethodName, Class[] pParams)
Copyright © 2018. All rights reserved.