Package org.apache.groovy.util
Class SystemUtil
- java.lang.Object
 - 
- org.apache.groovy.util.SystemUtil
 
 
- 
public class SystemUtil extends Object
 
- 
- 
Constructor Summary
Constructors Constructor Description SystemUtil() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleangetBooleanSafe(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 IntegergetIntegerSafe(String name, Integer def)Retrieves an Integer System propertystatic StringgetSystemPropertySafe(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 StringgetSystemPropertySafe(String name, 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 StringsetSystemPropertyFrom(String nameValue)Sets a system property from aname=valueString.static StringsetSystemPropertyFromSafe(String nameValue)Sets a system property from aname=valueString. 
 - 
 
- 
- 
Method Detail
- 
setSystemPropertyFrom
public static String setSystemPropertyFrom(String nameValue)
Sets a system property from aname=valueString. If no '=' is found, the property is assumed to be a Boolean flag with valuetrue.- Parameters:
 nameValue- the non-null name=value String- Returns:
 - the found name
 - Throws:
 IllegalArgumentException- if nameValue is null
 
- 
setSystemPropertyFromSafe
public static String setSystemPropertyFromSafe(String nameValue)
Sets a system property from aname=valueString. If no '=' is found, the property is assumed to be a Boolean flag with valuetrue. Does nothing if a Security manager is in place which doesn't allow the operation.- Parameters:
 nameValue- the non-null name=value String- Returns:
 - the found property name or null if the operation wasn't successful
 - Throws:
 IllegalArgumentException- if nameValue is null
 
- 
getSystemPropertySafe
public static String getSystemPropertySafe(String name, 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.
 
- Parameters:
 name- the name of the system property.defaultValue- a default value.- Returns:
 - value of the system property or the default value
 
 
- 
getSystemPropertySafe
public static String getSystemPropertySafe(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.
 
- Parameters:
 name- the name of the system property.- Returns:
 - value of the system property or null
 
 
- 
getBooleanSafe
public static boolean getBooleanSafe(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.
 
- Parameters:
 name- the name of the system property.- Returns:
 - value of the Boolean system property or false
 
 
 - 
 
 -