public class CombinedBuilderParametersImpl extends BasicBuilderParameters implements CombinedBuilderProperties<CombinedBuilderParametersImpl>
A specialized parameters object for a CombinedConfigurationBuilder.
This class defines methods for setting properties for customizing a builder for combined configurations. Note that some of these properties can also be set in the configuration definition file. If this is the case, the settings in the definition file override the content of this object.
This class is not thread-safe. It is intended that an instance is constructed and initialized by a single thread
during configuration of a ConfigurationBuilder.
RESERVED_PARAMETER_PREFIX| Constructor and Description |
|---|
CombinedBuilderParametersImpl()
Creates a new instance of
CombinedBuilderParametersImpl. |
| Modifier and Type | Method and Description |
|---|---|
CombinedBuilderParametersImpl |
clone()
Clones this object.
|
static CombinedBuilderParametersImpl |
fromParameters(Map<String,?> params)
Looks up an instance of this class in the specified parameters map.
|
static CombinedBuilderParametersImpl |
fromParameters(Map<String,?> params,
boolean createIfMissing)
Looks up an instance of this class in the specified parameters map and optionally creates a new one if none is found.
|
String |
getBasePath()
Returns the base path for relative names of configuration sources.
|
DefaultParametersManager |
getChildDefaultParametersManager()
Returns the
DefaultParametersManager object for initializing parameter objects for child configuration
sources. |
Collection<? extends BuilderParameters> |
getDefaultChildParameters()
Returns a collection with default parameter objects for child configuration sources.
|
ConfigurationBuilder<? extends HierarchicalConfiguration<?>> |
getDefinitionBuilder()
Returns the
ConfigurationBuilder object for obtaining the definition configuration. |
BuilderParameters |
getDefinitionBuilderParameters()
Returns the parameters object for the definition configuration builder if present.
|
Map<String,Object> |
getParameters()
Returns a map with all parameters defined by this objects.
|
Map<String,ConfigurationBuilderProvider> |
getProviders()
Returns an (unmodifiable) map with the currently registered
ConfigurationBuilderProvider objects. |
void |
inheritFrom(Map<String,?> source)
Inherits properties from the specified map.
|
boolean |
isInheritSettings()
Returns the current value of the flag that controls whether the settings of the parent combined configuration builder
should be inherited by its child configurations.
|
ConfigurationBuilderProvider |
providerForTag(String tagName)
Returns the
ConfigurationBuilderProvider which is registered for the specified tag name or null if
there is no registration for this tag. |
<D> CombinedBuilderParametersImpl |
registerChildDefaultsHandler(Class<D> paramClass,
DefaultParametersHandler<? super D> handler)
Registers a
DefaultParametersHandler for child configuration sources. |
<D> CombinedBuilderParametersImpl |
registerChildDefaultsHandler(Class<D> paramClass,
DefaultParametersHandler<? super D> handler,
Class<?> startClass)
Registers a
DefaultParametersHandler for child configuration sources derived from the given start class. |
CombinedBuilderParametersImpl |
registerMissingProviders(CombinedBuilderParametersImpl params)
Registers all
ConfigurationBuilderProviders in the given parameters object which have not yet been
registered. |
CombinedBuilderParametersImpl |
registerMissingProviders(Map<String,ConfigurationBuilderProvider> providers)
Registers all
ConfigurationBuilderProviders in the given map to this object which have not yet been
registered. |
CombinedBuilderParametersImpl |
registerProvider(String tagName,
ConfigurationBuilderProvider provider)
Registers the given
ConfigurationBuilderProvider for the specified tag name. |
CombinedBuilderParametersImpl |
setBasePath(String path)
Sets the base path for this combined configuration builder.
|
CombinedBuilderParametersImpl |
setChildDefaultParametersManager(DefaultParametersManager manager)
Sets a
DefaultParametersManager object responsible for managing the default parameter handlers to be applied
on child configuration sources. |
CombinedBuilderParametersImpl |
setDefinitionBuilder(ConfigurationBuilder<? extends HierarchicalConfiguration<?>> builder)
Sets the
ConfigurationBuilder for the definition configuration. |
CombinedBuilderParametersImpl |
setDefinitionBuilderParameters(BuilderParameters params)
Sets the parameters object for the definition configuration builder.
|
CombinedBuilderParametersImpl |
setInheritSettings(boolean inheritSettings)
Sets a flag whether the child configurations created by a
CombinedConfigurationBuilder should inherit the
settings defined for the builder. |
copyPropertiesFrom, fetchBeanHelper, fetchInterpolatorSpecification, fetchProperty, merge, setBeanHelper, setConfigurationDecoder, setConversionHandler, setDefaultLookups, setInterpolator, setListDelimiterHandler, setLogger, setParentInterpolator, setPrefixLookups, setSynchronizer, setThrowExceptionOnMissing, storePropertypublic CombinedBuilderParametersImpl()
CombinedBuilderParametersImpl.public static CombinedBuilderParametersImpl fromParameters(Map<String,?> params)
fromParameters(params, false);params - the map with parameters (must not be nullNullPointerException - if the map is nullpublic static CombinedBuilderParametersImpl fromParameters(Map<String,?> params, boolean createIfMissing)
getParameters() method.params - the map with parameters (must not be nullcreateIfMissing - determines the behavior if no instance is found in the map; if true, a new instance
with default settings is created; if false, null is returnedNullPointerException - if the map is nullpublic void inheritFrom(Map<String,?> source)
ConfigurationInterpolator - are
tightly connected to a configuration and cannot be reused in a different context. For other properties, e.g. a file
name, it does not make sense to copy it. Therefore, an implementation has to be explicit in the properties it wants
to take over. This implementation additionally copies some properties defined by this class.inheritFrom in class BasicBuilderParameterssource - the source properties to inherit frompublic boolean isInheritSettings()
public CombinedBuilderParametersImpl setInheritSettings(boolean inheritSettings)
CombinedBuilderPropertiesCombinedConfigurationBuilder should inherit the
settings defined for the builder. This is typically useful because for configurations coming from homogeneous sources
often similar conventions are used. Therefore, this flag is true per default.setInheritSettings in interface CombinedBuilderProperties<CombinedBuilderParametersImpl>inheritSettings - the flag whether settings should be inherited by child configurationspublic ConfigurationBuilder<? extends HierarchicalConfiguration<?>> getDefinitionBuilder()
ConfigurationBuilder object for obtaining the definition configuration.ConfigurationBuilderpublic CombinedBuilderParametersImpl setDefinitionBuilder(ConfigurationBuilder<? extends HierarchicalConfiguration<?>> builder)
ConfigurationBuilder for the definition configuration. This is the configuration which contains the
configuration sources that form the combined configuration.setDefinitionBuilder in interface CombinedBuilderProperties<CombinedBuilderParametersImpl>builder - the definition ConfigurationBuilderpublic CombinedBuilderParametersImpl registerProvider(String tagName, ConfigurationBuilderProvider provider)
ConfigurationBuilderProvider for the specified tag name. This means that whenever this
tag is encountered in a configuration definition file, the corresponding builder provider is invoked.registerProvider in interface CombinedBuilderProperties<CombinedBuilderParametersImpl>tagName - the name of the tag (must not be null)provider - the ConfigurationBuilderProvider (must not be null)IllegalArgumentException - if a required parameter is missingpublic CombinedBuilderParametersImpl registerMissingProviders(Map<String,ConfigurationBuilderProvider> providers)
ConfigurationBuilderProviders in the given map to this object which have not yet been
registered. This method is mainly used for internal purposes: a CombinedConfigurationBuilder takes the
providers contained in a parameters object and adds all standard providers. This way it is possible to override a
standard provider by registering a provider object for the same tag name at the parameters object.providers - a map with tag names and corresponding providers (must not be null or contain null
entries)IllegalArgumentException - if the map with providers is null or contains null entriespublic CombinedBuilderParametersImpl registerMissingProviders(CombinedBuilderParametersImpl params)
ConfigurationBuilderProviders in the given parameters object which have not yet been
registered. This method works like the method with the same name, but the map with providers is obtained from the
passed in parameters object.params - the parameters object from which to copy providers(must not be null)IllegalArgumentException - if the source parameters object is nullpublic Map<String,ConfigurationBuilderProvider> getProviders()
ConfigurationBuilderProvider objects.ConfigurationBuilderProvider objects (the keys are the tag names)public ConfigurationBuilderProvider providerForTag(String tagName)
ConfigurationBuilderProvider which is registered for the specified tag name or null if
there is no registration for this tag.tagName - the tag namepublic String getBasePath()
public CombinedBuilderParametersImpl setBasePath(String path)
setBasePath in interface CombinedBuilderProperties<CombinedBuilderParametersImpl>path - the base path for resolving relative file namespublic BuilderParameters getDefinitionBuilderParameters()
public CombinedBuilderParametersImpl setDefinitionBuilderParameters(BuilderParameters params)
setDefinitionBuilder(ConfigurationBuilder)
method). In this case, a builder for an XML configuration is created and configured with this parameters object.setDefinitionBuilderParameters in interface CombinedBuilderProperties<CombinedBuilderParametersImpl>params - the parameters object for the definition configuration builderpublic Collection<? extends BuilderParameters> getDefaultChildParameters()
addChildParameters(). The returned collection is a
defensive copy; it can be modified, but this has no effect on the parameters stored in this object.public DefaultParametersManager getChildDefaultParametersManager()
DefaultParametersManager object for initializing parameter objects for child configuration
sources. This method never returns null. If no manager was set, a new instance is created right now.DefaultParametersManager for child configuration sourcespublic CombinedBuilderParametersImpl setChildDefaultParametersManager(DefaultParametersManager manager)
DefaultParametersManager object responsible for managing the default parameter handlers to be applied
on child configuration sources. When creating builders for child configuration sources their parameters are
initialized using this DefaultParametersManager instance. This way, meaningful defaults can be set. Note that
calling this method overrides all DefaultParametersHandler objects previously set by one of the
registerChildDefaultsHandler() methods! So either use this method if a pre-configured manager object is to be
set or call the registerChildDefaultHandler() methods with the handlers to be registered (in the latter case,
it is not necessary to set a DefaultParametersManager explicitly; a default one is created behind the
scenes). This implementation stores the passed in manager object. An already existing manager object (either
explicitly set or created on demand) is overridden. This also removes all default handlers registered before!setChildDefaultParametersManager in interface CombinedBuilderProperties<CombinedBuilderParametersImpl>manager - the DefaultParametersManagerpublic <D> CombinedBuilderParametersImpl registerChildDefaultsHandler(Class<D> paramClass, DefaultParametersHandler<? super D> handler)
DefaultParametersHandler for child configuration sources. With this method an arbitrary number of
handler objects can be set. When creating builders for child configuration sources their parameters are initialized
by invoking all matching DefaultParametersHandlers on them. So, basically the same mechanism is used for the
initialization of parameters for child configuration sources as for normal parameter objects. This implementation registers the passed in handler at an internal DefaultParametersManager
instance. If none was set, a new instance is created now.registerChildDefaultsHandler in interface CombinedBuilderProperties<CombinedBuilderParametersImpl>D - the type of the handler to be registeredparamClass - the parameter class supported by the handlerhandler - the DefaultParametersHandler to be registeredDefaultParametersManager.registerDefaultsHandler(Class, DefaultParametersHandler)public <D> CombinedBuilderParametersImpl registerChildDefaultsHandler(Class<D> paramClass, DefaultParametersHandler<? super D> handler, Class<?> startClass)
DefaultParametersHandler for child configuration sources derived from the given start class. This
method works like the overloaded variant, but limits the application of the defaults handler to specific child
configuration sources. This implementation registers the passed in handler at an internal DefaultParametersManager
instance. If none was set, a new instance is created now.registerChildDefaultsHandler in interface CombinedBuilderProperties<CombinedBuilderParametersImpl>D - the type of the handler to be registeredparamClass - the parameter class supported by the handlerhandler - the DefaultParametersHandler to be registeredstartClass - an optional start class in the hierarchy of parameter objects for which this handler should be
appliedDefaultParametersManager.registerDefaultsHandler(Class, DefaultParametersHandler, Class)public Map<String,Object> getParameters()
Configuration implementation class the builder produces. The values are the corresponding
property values. The return value must not be null. This implementation returns a copy of the internal parameters map with the values set so far.
Collection structures (e.g. for lookup objects) are stored as defensive copies, so the original data cannot be
modified. This implementation returns a map which contains this object itself under a specific key. The static
fromParameters() method can be used to extract an instance from a parameters map.getParameters in interface BuilderParametersgetParameters in class BasicBuilderParameterspublic CombinedBuilderParametersImpl clone()
ConfigurationInterpolator or
Lookups are shared between this and the newly created instance. This implementation also clones the parameters object for the definition builder if possible.clone in class BasicBuilderParametersCopyright © 2001–2022 The Apache Software Foundation. All rights reserved.