public final class ConfigurationHelper
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.util.Map |
clone(java.util.Map<?,?> configurationValues)
Make a clone of the configuration values.
|
static java.lang.String |
extractPropertyValue(java.lang.String propertyName,
java.util.Map properties)
Extract a property value by name from the given properties object.
|
static java.lang.String |
extractPropertyValue(java.lang.String propertyName,
java.util.Properties properties)
Extract a property value by name from the given properties object.
|
static boolean |
getBoolean(java.lang.String name,
java.util.Map values)
Get the config value as a boolean (default of false)
|
static boolean |
getBoolean(java.lang.String name,
java.util.Map values,
boolean defaultValue)
Get the config value as a boolean.
|
static java.lang.Boolean |
getBooleanWrapper(java.lang.String name,
java.util.Map values,
java.lang.Boolean defaultValue)
Get the config value as a boolean (default of false)
|
static int |
getInt(java.lang.String name,
java.util.Map values,
int defaultValue)
Get the config value as an int
|
static java.lang.Integer |
getInteger(java.lang.String name,
java.util.Map values)
Get the config value as an
Integer |
static long |
getLong(java.lang.String name,
java.util.Map values,
int defaultValue) |
static java.lang.String |
getString(java.lang.String name,
java.util.Map values)
Get the config value as a
String |
static java.lang.String |
getString(java.lang.String name,
java.util.Map values,
java.lang.String defaultValue)
Get the config value as a
String |
static java.lang.String |
getString(java.lang.String name,
java.util.Map values,
java.lang.String defaultValue,
java.lang.String... otherSupportedValues)
Get the config value as a
String. |
static java.util.Properties |
maskOut(java.util.Properties props,
java.lang.String key)
replace a property by a starred version
|
static java.lang.String |
resolvePlaceHolder(java.lang.String property)
Handles interpolation processing for a single property.
|
static void |
resolvePlaceHolders(java.util.Map<?,?> configurationValues)
Handles interpolation processing for all entries in a properties object.
|
static java.util.Map |
toMap(java.lang.String propertyName,
java.lang.String delim,
java.util.Map properties)
Constructs a map from a property value.
|
static java.util.Map |
toMap(java.lang.String propertyName,
java.lang.String delim,
java.util.Properties properties)
Constructs a map from a property value.
|
static java.lang.String[] |
toStringArray(java.lang.String stringForm,
java.lang.String delim)
Convert a string to an array of strings.
|
static java.lang.String[] |
toStringArray(java.lang.String propertyName,
java.lang.String delim,
java.util.Properties properties)
Get a property value as a string array.
|
public static java.lang.String getString(java.lang.String name,
java.util.Map values)
Stringname - The config setting name.values - The map of config valuespublic static java.lang.String getString(java.lang.String name,
java.util.Map values,
java.lang.String defaultValue)
Stringname - The config setting name.values - The map of config valuesdefaultValue - The default value to use if not foundpublic static java.lang.String getString(java.lang.String name,
java.util.Map values,
java.lang.String defaultValue,
java.lang.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(java.lang.String name,
java.util.Map values)
name - The config setting name.values - The map of config valuespublic static boolean getBoolean(java.lang.String name,
java.util.Map values,
boolean defaultValue)
name - The config setting name.values - The map of config valuesdefaultValue - The default value to use if not foundpublic static java.lang.Boolean getBooleanWrapper(java.lang.String name,
java.util.Map values,
java.lang.Boolean defaultValue)
name - The config setting name.values - The map of config valuespublic static int getInt(java.lang.String name,
java.util.Map values,
int defaultValue)
name - The config setting name.values - The map of config valuesdefaultValue - The default value to use if not foundpublic static java.lang.Integer getInteger(java.lang.String name,
java.util.Map values)
Integername - The config setting name.values - The map of config valuespublic static long getLong(java.lang.String name,
java.util.Map values,
int defaultValue)
public static java.util.Map clone(java.util.Map<?,?> configurationValues)
configurationValues - The config values to clonepublic static java.util.Properties maskOut(java.util.Properties props,
java.lang.String key)
props - properties to checkkey - proeprty to maskpublic static java.lang.String extractPropertyValue(java.lang.String propertyName,
java.util.Properties properties)
propertyName - The name of the property for which to extract valueproperties - The properties objectpublic static java.lang.String extractPropertyValue(java.lang.String propertyName,
java.util.Map properties)
propertyName - The name of the property for which to extract valueproperties - The properties objectpublic static java.util.Map toMap(java.lang.String propertyName,
java.lang.String delim,
java.util.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 java.util.Map toMap(java.lang.String propertyName,
java.lang.String delim,
java.util.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 java.lang.String[] toStringArray(java.lang.String propertyName,
java.lang.String delim,
java.util.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 java.lang.String[] toStringArray(java.lang.String stringForm,
java.lang.String delim)
stringForm - The string form of the string array.delim - The delimiter used to separate individual array elements.public static void resolvePlaceHolders(java.util.Map<?,?> configurationValues)
configurationValues - The configuration map.public static java.lang.String resolvePlaceHolder(java.lang.String property)
property - The property value to be processed for interpolation.Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.