public class MultiFileBuilderParametersImpl extends BasicBuilderParameters implements MultiFileBuilderProperties<MultiFileBuilderParametersImpl>
A specialized parameters object for MultiFileConfigurationBuilder
.
A parameters object of this type is used by a configuration builder with manages multiple file-based configurations. Such a builder is a bit special because it does not create a configuration on its own, but delegates to a file-based builder for this purpose. Therefore, parameters inherited from the super class are treated differently:
ConfigurationInterpolator
is needed by a
MultiFileConfigurationBuilder
to resolve the file pattern. It is
expected to be set and will not be passed to sub configurations created by
the builder.setManagedBuilderParameters(BuilderParameters)
method to define all
properties of sub configurations in a single place. If such a parameters
object is set, its properties take precedence.
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 |
---|
MultiFileBuilderParametersImpl() |
Modifier and Type | Method and Description |
---|---|
MultiFileBuilderParametersImpl |
clone()
Clones this object.
|
static MultiFileBuilderParametersImpl |
fromParameters(Map<String,Object> params)
Obtains an instance of this class from the given map with parameters.
|
static MultiFileBuilderParametersImpl |
fromParameters(Map<String,Object> params,
boolean createIfMissing)
Obtains an instance of this class from the given map with parameters and
creates a new object if such an instance cannot be found.
|
String |
getFilePattern()
Returns the pattern for determining file names for managed
configurations.
|
BuilderParameters |
getManagedBuilderParameters()
Returns the parameters object for managed configuration builders.
|
Map<String,Object> |
getParameters()
Returns a map with all parameters defined by this objects.
|
MultiFileBuilderParametersImpl |
setFilePattern(String p)
Sets the pattern string.
|
MultiFileBuilderParametersImpl |
setManagedBuilderParameters(BuilderParameters p)
Sets a parameters object to be used when creating a managed
configuration.
|
copyPropertiesFrom, fetchBeanHelper, fetchInterpolatorSpecification, fetchProperty, inheritFrom, merge, setBeanHelper, setConfigurationDecoder, setConversionHandler, setDefaultLookups, setInterpolator, setListDelimiterHandler, setLogger, setParentInterpolator, setPrefixLookups, setSynchronizer, setThrowExceptionOnMissing, storeProperty
public static MultiFileBuilderParametersImpl fromParameters(Map<String,Object> params)
fromParameters(params, false)
.params
- the map with parameters (must not be null)NullPointerException
- if the map with parameters is nullpublic static MultiFileBuilderParametersImpl fromParameters(Map<String,Object> params, boolean createIfMissing)
getParameters()
method. If the map does not contain an instance
under the expected key and the createIfMissing
parameter is
true, a new instance is created. Otherwise, result is null.params
- the map with parameters (must not be null)createIfMissing
- a flag whether a new instance should be created if
necessaryNullPointerException
- if the map with parameters is nullpublic String getFilePattern()
public MultiFileBuilderParametersImpl setFilePattern(String p)
MultiFileBuilderProperties
setFilePattern
in interface MultiFileBuilderProperties<MultiFileBuilderParametersImpl>
p
- the pattern stringpublic BuilderParameters getManagedBuilderParameters()
public MultiFileBuilderParametersImpl setManagedBuilderParameters(BuilderParameters p)
MultiFileBuilderProperties
setManagedBuilderParameters
in interface MultiFileBuilderProperties<MultiFileBuilderParametersImpl>
p
- the parameters object for a sub configurationpublic 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 puts a reference to this object under a
reserved key in the resulting parameters map.getParameters
in interface BuilderParameters
getParameters
in class BasicBuilderParameters
public MultiFileBuilderParametersImpl clone()
ConfigurationInterpolator
or
Lookup
s are shared between this and the newly created instance. This implementation also tries to clone the parameters
object for managed builders if possible.clone
in class BasicBuilderParameters
Copyright © 2001–2020 The Apache Software Foundation. All rights reserved.