Package org.hibernate.engine.config.spi
Interface ConfigurationService
-
- All Superinterfaces:
Serializable
,Service
- All Known Implementing Classes:
ConfigurationServiceImpl
public interface ConfigurationService extends Service
Provides access to the initial user-provided configuration values. Generally speaking these values come from:- Calls to
StandardServiceRegistryBuilder.loadProperties(java.lang.String)
- Calls to
StandardServiceRegistryBuilder.applySetting(java.lang.String, java.lang.Object)
- Calls to
StandardServiceRegistryBuilder.applySettings(java.util.Map<java.lang.String, java.lang.Object>)
- Calls to
StandardServiceRegistryBuilder.configure()
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ConfigurationService.Converter<T>
Simple conversion contract for converting an untyped object to a specified type.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> @PolyNull T
getSetting(String name, Class<T> expected, @PolyNull T defaultValue)
Get the named setting.<T> @Nullable T
getSetting(String name, ConfigurationService.Converter<T> converter)
Get the named setting, using the specified converter.<T> @PolyNull T
getSetting(String name, ConfigurationService.Converter<T> converter, @PolyNull T defaultValue)
Get the named setting, using the specified converter and default value.Map<String,Object>
getSettings()
Access to the complete map of config settings.
-
-
-
Method Detail
-
getSettings
Map<String,Object> getSettings()
Access to the complete map of config settings. The returned map is immutable- Returns:
- The immutable map of config settings.
-
getSetting
<T> @Nullable T getSetting(String name, ConfigurationService.Converter<T> converter)
Get the named setting, using the specified converter.- Type Parameters:
T
- The Java type of the conversion- Parameters:
name
- The name of the setting to get.converter
- The converter to apply- Returns:
- The converted (typed) setting. May return
null
(seegetSetting(String, Class, Object)
)
-
getSetting
<T> @PolyNull T getSetting(String name, ConfigurationService.Converter<T> converter, @PolyNull T defaultValue)
Get the named setting, using the specified converter and default value.- Type Parameters:
T
- The Java type of the conversion- Parameters:
name
- The name of the setting to get.converter
- The converter to applydefaultValue
- If no setting with that name is found, return this default value as the result.- Returns:
- The converted (typed) setting. Will be the defaultValue if no such setting was defined.
-
getSetting
<T> @PolyNull T getSetting(String name, Class<T> expected, @PolyNull T defaultValue)
Get the named setting. Differs from the form taking a Converter in that here we expect to have a simple cast rather than any involved conversion.- Type Parameters:
T
- The Java type of the conversion- Parameters:
name
- The name of the setting to get.expected
- The expected Java type.defaultValue
- If no setting with that name is found, return this default value as the result.- Returns:
- The converted (typed) setting. Will be the defaultValue if no such setting was defined.
-
-