package org.hibernate.internal.util.config;
Collection of helper methods for dealing with configuration settings.
- Author(s):
- Gavin King
- Steve Ebersole
Get the config value as a
java.lang.String
- Parameters:
name The config setting name.values The map of config values- Returns:
- The value, or null if not found
Get the config value as a
java.lang.String
- Parameters:
name The config setting name.values The map of config valuesdefaultValue The default value to use if not found- Returns:
- The value.
return value == null ? defaultValue : value;
Get the config value as a boolean (default of false)
- Parameters:
name The config setting name.values The map of config values- Returns:
- The value.
Get the config value as a boolean.
- Parameters:
name The config setting name.values The map of config valuesdefaultValue The default value to use if not found- Returns:
- The value.
"Could not determine how to handle configuration value [name=" + name + ", value=" + value + "] as boolean"
Get the config value as an int
- Parameters:
name The config setting name.values The map of config valuesdefaultValue The default value to use if not found- Returns:
- The value.
"Could not determine how to handle configuration value [name=" + name +
Get the config value as an
java.lang.Integer
- Parameters:
name The config setting name.values The map of config values- Returns:
- The value, or null if not found
"Could not determine how to handle configuration value [name=" + name +
Make a clone of the configuration values.
- Parameters:
configurationValues The config values to clone- Returns:
- The clone
public static Map clone(Map<?,?> configurationValues) { if ( configurationValues == null ) { replace a property by a starred version
- Parameters:
props properties to checkkey proeprty to mask- Returns:
- cloned and masked properties
if ( clone.get( key ) != null ) { Extract a property value by name from the given properties object.
Both null and empty string are viewed as the same, and return null.
- Parameters:
propertyName The name of the property for which to extract valueproperties The properties object- Returns:
- The property value; may be null.
if ( StringHelper.isEmpty( value ) ) { Constructs a map from a property value.
The exact behavior here is largely dependant upon what is passed in as
the delimiter.
- Parameters:
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 object- Returns:
- The resulting map; never null, though perhaps empty.
- See also:
extractPropertyValue(java.lang.String,java.util.Properties)
Get a property value as a string array.
Convert a string to an array of strings. The assumption is that
the individual array elements are delimited in the source stringForm
param by the delim param.
- Parameters:
stringForm The string form of the string array.delim The delimiter used to separate individual array elements.- Returns:
- The array; never null, though may be empty.
if ( stringForm != null ) { return StringHelper.split( delim, stringForm );
Handles interpolation processing for all entries in a properties object.
- Parameters:
configurationValues The configuration map.
if ( !value.equals( resolved ) ) { if ( resolved == null ) { Handles interpolation processing for a single property.
- Parameters:
property The property value to be processed for interpolation.- Returns:
- The (possibly) interpolated property value.
for ( int pos = 0; pos < chars.length; pos++ ) { if ( chars[pos] == '$' ) { if ( chars[pos+1] == '{' ) { String systemPropertyName = "";
for ( ; x < chars.length && chars[x] != '}'; x++ ) { systemPropertyName += chars[x];
if ( x == chars.length - 1 ) { buff.append( systemProperty == null ? "" : systemProperty );
if ( pos >= chars.length ) { return StringHelper.isEmpty( rtn ) ? null : rtn;