public class SystemUtil
extends java.lang.Object
Constructor and Description |
---|
SystemUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
getBooleanSafe(java.lang.String name)
Retrieves a Boolean System property, or returns false if:
the property isn't found
the property name is null or empty
if a security manager exists and its checkPropertyAccess method doesn't allow access to the specified system property.
|
static java.lang.String |
getSystemPropertySafe(java.lang.String name)
Retrieves a System property, or null if:
the property isn't found
the property name is null or empty
if a security manager exists and its checkPropertyAccess method doesn't allow access to the specified system property.
|
static java.lang.String |
getSystemPropertySafe(java.lang.String name,
java.lang.String defaultValue)
Retrieves a System property, or returns some default value if:
the property isn't found
the property name is null or empty
if a security manager exists and its checkPropertyAccess method doesn't allow access to the specified system property.
|
static java.lang.String |
setSystemPropertyFrom(java.lang.String nameValue)
Sets a system property from a
name=value String. |
static java.lang.String |
setSystemPropertyFromSafe(java.lang.String nameValue)
Sets a system property from a
name=value String. |
public static java.lang.String setSystemPropertyFrom(java.lang.String nameValue)
name=value
String.
If no '=' is found, the property is assumed to be a Boolean flag with value true
.nameValue
- the non-null name=value Stringjava.lang.IllegalArgumentException
- if nameValue is nullpublic static java.lang.String setSystemPropertyFromSafe(java.lang.String nameValue)
name=value
String.
If no '=' is found, the property is assumed to be a Boolean flag with value true
.
Does nothing if a Security manager is in place which doesn't allow the operation.nameValue
- the non-null name=value Stringjava.lang.IllegalArgumentException
- if nameValue is nullpublic static java.lang.String getSystemPropertySafe(java.lang.String name, java.lang.String defaultValue)
name
- the name of the system property.defaultValue
- a default value.public static java.lang.String getSystemPropertySafe(java.lang.String name)
name
- the name of the system property.public static boolean getBooleanSafe(java.lang.String name)
name
- the name of the system property.