public class ConfigurationUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
getBoolean(Map<String,String> settings,
String name,
boolean defaultValue)
Convert value of this setting to a Java boolean (via
Boolean.parseBoolean(String)). |
static int |
getInt(Map<String,String> settings,
String name)
Convert value of this setting to a Java int.
|
static int |
getInt(Map<String,String> settings,
String name,
int defaultValue)
Convert value of this setting to a Java int.
|
static long |
getLong(Map<String,String> settings,
String name,
long defaultValue)
Convert value of this setting to a Java long.
|
static String |
getString(Map<String,String> settings,
String name)
Convert value of this setting to a Java int.
|
static String |
getString(Map<String,String> settings,
String name,
String defaultValue)
Return the value of the given property.
|
public static int getInt(Map<String,String> settings, String name) throws IllegalArgumentException
name - name of the setting / propertyIllegalArgumentException - if setting is not found or is not an integer.public static int getInt(Map<String,String> settings, String name, int defaultValue) throws IllegalArgumentException
defaultValue is returned. If the property is not an int, an exception is thrown.name - name of the propertydefaultValue - default value if the property is not defined.defaultValue if the property is not defined.IllegalArgumentException - if setting is not is not an integer.public static long getLong(Map<String,String> settings, String name, long defaultValue) throws IllegalArgumentException
defaultValue is returned. If the property is not a long, an exception is thrown.name - name of the propertydefaultValue - default value if the property is not defined.defaultValue if the property is not defined.IllegalArgumentException - if setting is not is not a long.public static boolean getBoolean(Map<String,String> settings, String name, boolean defaultValue)
Boolean.parseBoolean(String)).
If the property is not found, the defaultValue is returned.name - name of the propertydefaultValue - default value if the property is not defined.defaultValue if the property is not defined.public static String getString(Map<String,String> settings, String name) throws IllegalArgumentException
name - name of the propertyIllegalArgumentException - if setting is not found.public static String getString(Map<String,String> settings, String name, String defaultValue)
defaultValue is returned.name - name of the propertydefaultValue - default value if the property is not defined.defaultValue if the property is not defined.Copyright © 2015. All Rights Reserved.