Top Constructors Methods
org.apache.groovy.util

public Class SystemUtil

extends Object
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

value of the Boolean system property or false
getBooleanSafe
(String
the name of the system property.
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.
public static Integer

Returns:

value of the Integer system property or the default value
getIntegerSafe
(String
the name of the system property.
name
,
Integer
the default value
def
)

Retrieves an Integer System property

public static Long

Returns:

value of the Long system property or the default value
getLongSafe
(String
the name of the system property.
name
,
Long
the default value
def
)

Retrieves an Long System property

public static String

Returns:

value of the system property or the default value
getSystemPropertySafe
(String
the name of the system property.
name
,
String
a default value.
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.
public static String

Returns:

value of the system property or null
getSystemPropertySafe
(String
the name of the system property.
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.
public static String

Returns:

the found name
setSystemPropertyFrom
(final String
the non-null name=value String
nameValue
)

Sets a system property from a name=value String.

public static String

Returns:

the found property name or null if the operation wasn't successful
setSystemPropertyFromSafe
(final String
the non-null name=value String
nameValue
)

Sets a system property from a name=value String.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SystemUtilback to summary
public SystemUtil()

Method Detail

getBooleanSafeback to summary
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:String

the name of the system property.

Returns:boolean

value of the Boolean system property or false

getIntegerSafeback to summary
public static Integer getIntegerSafe(String name, Integer def)

Retrieves an Integer System property

Parameters
name:String

the name of the system property.

def:Integer

the default value

Returns:Integer

value of the Integer system property or the default value

getLongSafeback to summary
public static Long getLongSafe(String name, Long def)

Retrieves an Long System property

Parameters
name:String

the name of the system property.

def:Long

the default value

Returns:Long

value of the Long system property or the default value

getSystemPropertySafeback to summary
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:String

the name of the system property.

defaultValue:String

a default value.

Returns:String

value of the system property or the default value

getSystemPropertySafeback to summary
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:String

the name of the system property.

Returns:String

value of the system property or null

setSystemPropertyFromback to summary
public static String setSystemPropertyFrom(final String nameValue)

Sets a system property from a name=value String. If no '=' is found, the property is assumed to be a Boolean flag with value true.

Parameters
nameValue:String

the non-null name=value String

Returns:String

the found name

Exceptions
IllegalArgumentException:
if nameValue is null
setSystemPropertyFromSafeback to summary
public static String setSystemPropertyFromSafe(final String nameValue)

Sets a system property from a 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.

Parameters
nameValue:String

the non-null name=value String

Returns:String

the found property name or null if the operation wasn't successful

Exceptions
IllegalArgumentException:
if nameValue is null