Class ConfigurationHelper
java.lang.Object
org.hibernate.internal.util.config.ConfigurationHelper
Collection of helper methods for dealing with configuration settings.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Map
Deprecated, for removal: This API element is subject to removal in a future version.No longer usedstatic 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 String
extractValue
(String name, Map<?, ?> values, Supplier<String> fallbackValueFactory) 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
Get the config value as an intstatic Integer
getInteger
(String name, Map<?, ?> values) Get the config value as anInteger
static long
static int
getPreferredSqlTypeCodeForArray
(StandardServiceRegistry serviceRegistry) static int
getPreferredSqlTypeCodeForBoolean
(StandardServiceRegistry serviceRegistry) static int
getPreferredSqlTypeCodeForBoolean
(ServiceRegistry serviceRegistry, Dialect dialect) static int
getPreferredSqlTypeCodeForDuration
(StandardServiceRegistry serviceRegistry) static int
getPreferredSqlTypeCodeForInstant
(StandardServiceRegistry serviceRegistry) static int
getPreferredSqlTypeCodeForUuid
(StandardServiceRegistry serviceRegistry) static String
Get the config value as aString
static String
Get the config value as aString
static String
Get the config value as aString
static String
Get the config value as aString
static Properties
maskOut
(Properties props, String key) replace a property by a starred versionstatic String
resolvePlaceHolder
(String property) Handles interpolation processing for a single property.static void
resolvePlaceHolders
(Map<?, Object> configurationValues) Handles interpolation processing for all entries in a properties object.static void
static void
Deprecated, for removal: This API element is subject to removal in a future version.static Boolean
static Map
Deprecated, for removal: This API element is subject to removal in a future version.No longer usedstatic Map
toMap
(String propertyName, String delim, Properties properties) Deprecated, for removal: This API element is subject to removal in a future version.No longer usedstatic 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.
-
Method Details
-
getString
Get the config value as aString
- Parameters:
name
- The config setting name.values
- The map of config values- Returns:
- The value, or null if not found
-
getString
Get the config value as aString
- Parameters:
preferred
- The preferred config setting name.fallback
- The fallback config setting name, when the preferred configuration is not set.values
- The map of config values- Returns:
- The value, or null if not found
-
getString
Get the config value as aString
- Parameters:
name
- The config setting name.values
- The map of config valuesdefaultValue
- The default value to use if not found- Returns:
- The value.
-
getString
Get the config value as aString
- Parameters:
name
- The config setting name.values
- The map of config values- Returns:
- The value, or null if not found
-
getBoolean
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.
-
getBoolean
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.
-
toBoolean
-
getBooleanWrapper
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.
-
getInt
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.
-
getInteger
Get the config value as anInteger
- Parameters:
name
- The config setting name.values
- The map of config values- Returns:
- The value, or null if not found
-
getLong
-
clone
Deprecated, for removal: This API element is subject to removal in a future version.No longer usedMake a clone of the configuration values.- Parameters:
configurationValues
- The config values to clone- Returns:
- The clone
-
maskOut
replace a property by a starred version- Parameters:
props
- properties to checkkey
- property to mask- Returns:
- cloned and masked properties
-
extractPropertyValue
Extract a property value by name from the given properties object.Both
null
andempty 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.
-
extractPropertyValue
Extract a property value by name from the given properties object.Both
null
andempty 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.
-
extractValue
-
toMap
@Deprecated(since="7", forRemoval=true) public static Map toMap(String propertyName, String delim, Properties properties) Deprecated, for removal: This API element is subject to removal in a future version.No longer usedConstructs 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:
-
toMap
@Deprecated(since="7", forRemoval=true) public static Map toMap(String propertyName, String delim, Map<?, ?> properties) Deprecated, for removal: This API element is subject to removal in a future version.No longer usedConstructs 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:
-
toStringArray
Get a property value as a string array.- Parameters:
propertyName
- The name of the property for which to retrieve valuedelim
- The delimiter used to separate individual array elements.properties
- The properties object- Returns:
- The array; never null, though may be empty.
- See Also:
-
toStringArray
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.
-
resolvePlaceHolders
Handles interpolation processing for all entries in a properties object.- Parameters:
configurationValues
- The configuration map.
-
resolvePlaceHolder
Handles interpolation processing for a single property.- Parameters:
property
- The property value to be processed for interpolation.- Returns:
- The (possibly) interpolated property value.
-
getPreferredSqlTypeCodeForBoolean
@Incubating public static int getPreferredSqlTypeCodeForBoolean(StandardServiceRegistry serviceRegistry) -
getPreferredSqlTypeCodeForBoolean
@Incubating public static int getPreferredSqlTypeCodeForBoolean(ServiceRegistry serviceRegistry, Dialect dialect) -
getPreferredSqlTypeCodeForDuration
@Incubating public static int getPreferredSqlTypeCodeForDuration(StandardServiceRegistry serviceRegistry) -
getPreferredSqlTypeCodeForUuid
@Incubating public static int getPreferredSqlTypeCodeForUuid(StandardServiceRegistry serviceRegistry) -
getPreferredSqlTypeCodeForInstant
@Incubating public static int getPreferredSqlTypeCodeForInstant(StandardServiceRegistry serviceRegistry) -
getPreferredSqlTypeCodeForArray
@Incubating public static int getPreferredSqlTypeCodeForArray(StandardServiceRegistry serviceRegistry) -
setIfNotEmpty
-
setIfNotNull
@Deprecated(since="7", forRemoval=true) public static void setIfNotNull(Object value, String settingName, Map<String, Object> configuration) Deprecated, for removal: This API element is subject to removal in a future version.
-