util
Class SystemProperties

java.lang.Object
  extended by util.SystemProperties

public class SystemProperties
extends Object

Utility class to deal with retrieving properties from System.


Constructor Summary
SystemProperties()
           
 
Method Summary
static boolean getBooleanProperty(String name, boolean def)
          Returns the boolean value associated with the given system property, or the default if the property was unset or a string other than "true" or "false."
static double getDoubleProperty(String name, double def)
          Returns the double value associated with the given system property, or the default if the property was unset or set to an unparseable string.
static
<T extends Enum<T>>
T
getEnumProperty(String name, Class<T> enumType, T def)
          Returns the enum value associated with the given system property or the default if the property was unset or set to an unparseable value.
static int getIntProperty(String name, int def)
          Returns the integer value associated with the given system property, or the default if the property was unset or set to an unparseable string.
static long getLongProperty(String name, long def)
          Returns the long value associated with the given system property, or the default if the property was unset or set to an unparseable string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemProperties

public SystemProperties()
Method Detail

getEnumProperty

public static <T extends Enum<T>> T getEnumProperty(String name,
                                                    Class<T> enumType,
                                                    T def)
Returns the enum value associated with the given system property or the default if the property was unset or set to an unparseable value.

Parameters:
name - Name of the System.getProperty() property to fetch
def - Default value if property not found
Returns:
The value associated with the property or the default value

getIntProperty

public static int getIntProperty(String name,
                                 int def)
Returns the integer value associated with the given system property, or the default if the property was unset or set to an unparseable string.

Parameters:
name - Name of the System.getProperty() property to fetch
def - Default value if property not found
Returns:
The value associated with the property or the default value

getLongProperty

public static long getLongProperty(String name,
                                   long def)
Returns the long value associated with the given system property, or the default if the property was unset or set to an unparseable string.

Parameters:
name - Name of the System.getProperty() property to fetch
def - Default value if property not found
Returns:
The value associated with the property or the default value

getDoubleProperty

public static double getDoubleProperty(String name,
                                       double def)
Returns the double value associated with the given system property, or the default if the property was unset or set to an unparseable string.

Parameters:
name - Name of the System.getProperty() property to fetch
def - Default value if property not found
Returns:
The value associated with the property or the default value

getBooleanProperty

public static boolean getBooleanProperty(String name,
                                         boolean def)
Returns the boolean value associated with the given system property, or the default if the property was unset or a string other than "true" or "false."

Parameters:
name - Name of the System.getProperty() property to fetch
def - Default value if property not found
Returns:
The value associated with the property or the default value