public final class PropertiesHelper extends Object
Properties
objects.Modifier and Type | Method and Description |
---|---|
static String |
extractPropertyValue(String propertyName,
Properties properties)
Extract a property value by name from the given properties object.
|
static boolean |
getBoolean(String propertyName,
Properties properties)
Get a property value as a boolean.
|
static boolean |
getBoolean(String propertyName,
Properties properties,
boolean defaultValue)
Get a property value as a boolean.
|
static int |
getInt(String propertyName,
Properties properties,
int defaultValue)
Get a property value as an int.
|
static Integer |
getInteger(String propertyName,
Properties properties)
Get a property value as an Integer.
|
static String |
getString(String propertyName,
Properties properties,
String defaultValue)
Get a property 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(Properties properties)
Handles interpolation processing for all entries in a properties object.
|
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 propertyName, Properties properties, String defaultValue)
propertyName
- The name of the property for which to retrieve valueproperties
- The properties objectdefaultValue
- The default property value to use.extractPropertyValue(String, java.util.Properties)
public static String extractPropertyValue(String propertyName, Properties properties)
propertyName
- The name of the property for which to extract valueproperties
- The properties objectpublic static boolean getBoolean(String propertyName, Properties properties)
getBoolean(String, java.util.Properties, boolean)
with false
as the default value.propertyName
- The name of the property for which to retrieve valueproperties
- The properties objectpublic static boolean getBoolean(String propertyName, Properties properties, boolean defaultValue)
Boolean.valueOf(String)
is
used to determine the correct boolean value.propertyName
- The name of the property for which to retrieve valueproperties
- The properties objectdefaultValue
- The default property value to use.extractPropertyValue(String, java.util.Properties)
public static int getInt(String propertyName, Properties properties, int defaultValue)
Integer.parseInt(String)
is
used to determine the correct int value for any non-null property values.propertyName
- The name of the property for which to retrieve valueproperties
- The properties objectdefaultValue
- The default property value to use.extractPropertyValue(String, java.util.Properties)
public static Integer getInteger(String propertyName, Properties properties)
Integer.valueOf(String)
is
used to determine the correct boolean value for any non-null property values.propertyName
- The name of the property for which to retrieve valueproperties
- The properties objectextractPropertyValue(String, java.util.Properties)
public 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 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 Properties maskOut(Properties props, String key)
props
- properties to checkkey
- proeprty to maskpublic static void resolvePlaceHolders(Properties properties)
properties
- The properties object.Copyright © 2002-2017 Red Hat Middleware, LLC. All Rights Reserved