Package: org.apache.groovy.util

## [Java] Class SystemUtil

- org.apache.groovy.util.SystemUtil

-     public class SystemUtil
      extends Object

  Utility methods for interacting with system properties in a safe manner.

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `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
    `` | `public static Integer` | `getIntegerSafe(String name, Integer def)` Retrieves an Integer System property
    `` | `public static Long` | `getLongSafe(String name, Long def)` Retrieves a Long System property
    `` | `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
    `` | `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
    `` | `public static String` | `setSystemPropertyFrom(String nameValue)` Sets a system property from a `name=value` String.
    `` | `public static String` | `setSystemPropertyFromSafe(String nameValue)` Sets a system property from a `name=value` String.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### 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
      Parameters:
        `name` - the name of the system property.
      Returns:
        value of the Boolean system property or false

    - #### public static Integer getIntegerSafe(String name, Integer def)

      Retrieves an Integer System property

      Parameters:
        `name` - the name of the system property.
        `def` - the default value
      Returns:
        value of the Integer system property or the default value

    - #### public static Long getLongSafe(String name, Long def)

      Retrieves a Long System property

      Parameters:
        `name` - the name of the system property.
        `def` - the default value
      Returns:
        value of the Long system property or the default value

    - #### 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
      Parameters:
        `name` - the name of the system property.
        `defaultValue` - a default value.
      Returns:
        value of the system property or the default value

    - #### 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
      Parameters:
        `name` - the name of the system property.
      Returns:
        value of the system property or null

    - #### public static String setSystemPropertyFrom(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`.

      throws:
        IllegalArgumentException if nameValue is null
      Parameters:
        `nameValue` - the non-null name=value String
      Returns:
        the found name

    - #### public static String setSystemPropertyFromSafe(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`.

      throws:
        IllegalArgumentException if nameValue is null
      Parameters:
        `nameValue` - the non-null name=value String
      Returns:
        the found property name or null if the operation wasn't successful