public final class ConfigurationHelper extends Object
Modifier and Type | Method and Description |
---|---|
static Map |
clone(Map<?,?> configurationValues)
Make a clone of the configuration values.
|
static String |
extractPropertyValue(String propertyName,
Map properties)
Extract a property value by name from the given properties object.
|
static String |
extractPropertyValue(String propertyName,
Properties properties)
Extract a property value by name from the given properties object.
|
static boolean |
getBoolean(String name,
Map values)
Get the config value as a boolean (default of false)
|
static boolean |
getBoolean(String name,
Map values,
boolean defaultValue)
Get the config value as a boolean.
|
static Boolean |
getBooleanWrapper(String name,
Map values,
Boolean defaultValue)
Get the config value as a boolean (default of false)
|
static int |
getInt(String name,
Map values,
int defaultValue)
Get the config value as an int
|
static Integer |
getInteger(String name,
Map values)
Get the config value as an
Integer |
static long |
getLong(String name,
Map values,
int defaultValue) |
static String |
getString(String name,
Map values)
Get the config value as a
String |
static String |
getString(String name,
Map values,
String defaultValue)
Get the config value as a
String |
static String |
getString(String name,
Map values,
String defaultValue,
String... otherSupportedValues)
Get the config value as a
String . |
static Properties |
maskOut(Properties props,
String key)
replace a property by a starred version
|
static String |
resolvePlaceHolder(String property)
Handles interpolation processing for a single property.
|
static void |
resolvePlaceHolders(Map<?,?> configurationValues)
Handles interpolation processing for all entries in a properties object.
|
static Map |
toMap(String propertyName,
String delim,
Map properties)
Constructs a map from a property value.
|
static Map |
toMap(String propertyName,
String delim,
Properties properties)
Constructs a map from a property value.
|
static String[] |
toStringArray(String stringForm,
String delim)
Convert a string to an array of strings.
|
static String[] |
toStringArray(String propertyName,
String delim,
Properties properties)
Get a property value as a string array.
|
public static String getString(String name, Map values)
String
name
- The config setting name.values
- The map of config valuespublic static String getString(String name, Map values, String defaultValue)
String
name
- The config setting name.values
- The map of config valuesdefaultValue
- The default value to use if not foundpublic static String getString(String name, Map values, String defaultValue, String... otherSupportedValues)
String
.name
- The config setting name.values
- The map of config parameters.defaultValue
- The default value to use if not found.otherSupportedValues
- List of other supported values. Does not need to contain the default one.ConfigurationException
- Unsupported value provided.public static boolean getBoolean(String name, Map values)
name
- The config setting name.values
- The map of config valuespublic static boolean getBoolean(String name, Map values, boolean defaultValue)
name
- The config setting name.values
- The map of config valuesdefaultValue
- The default value to use if not foundpublic static Boolean getBooleanWrapper(String name, Map values, Boolean defaultValue)
name
- The config setting name.values
- The map of config valuespublic static int getInt(String name, Map values, int defaultValue)
name
- The config setting name.values
- The map of config valuesdefaultValue
- The default value to use if not foundpublic static Integer getInteger(String name, Map values)
Integer
name
- The config setting name.values
- The map of config valuespublic static Map clone(Map<?,?> configurationValues)
configurationValues
- The config values to clonepublic static Properties maskOut(Properties props, String key)
props
- properties to checkkey
- proeprty to maskpublic static String extractPropertyValue(String propertyName, Properties properties)
propertyName
- The name of the property for which to extract valueproperties
- The properties objectpublic static String extractPropertyValue(String propertyName, Map properties)
propertyName
- The name of the property for which to extract valueproperties
- The properties objectpublic static Map toMap(String propertyName, String delim, Properties properties)
propertyName
- The name of the property for which to retrieve valuedelim
- The string defining tokens used as both entry and key/value delimiters.properties
- The properties objectextractPropertyValue(String, java.util.Properties)
public static Map toMap(String propertyName, String delim, Map properties)
propertyName
- The name of the property for which to retrieve valuedelim
- The string defining tokens used as both entry and key/value delimiters.properties
- The properties objectextractPropertyValue(String, java.util.Properties)
public static String[] toStringArray(String propertyName, String delim, Properties properties)
propertyName
- The name of the property for which to retrieve valuedelim
- The delimiter used to separate individual array elements.properties
- The properties objectextractPropertyValue(String, java.util.Properties)
,
toStringArray(String, String)
public static String[] toStringArray(String stringForm, String delim)
stringForm
- The string form of the string array.delim
- The delimiter used to separate individual array elements.public static void resolvePlaceHolders(Map<?,?> configurationValues)
configurationValues
- The configuration map.Copyright © 2001-2017 Red Hat, Inc. All Rights Reserved.