public class FileBasedBuilderParametersImpl extends BasicBuilderParameters implements FileBasedBuilderProperties<FileBasedBuilderParametersImpl>
An implementation of BuilderParameters
which contains parameters related to Configuration
implementations that are loaded from files.
The parameters defined here are interpreted by builder implementations that can deal with file-based configurations. Note that these parameters are typically no initialization properties of configuration objects (i.e. they are not passed to set methods after the creation of the result configuration). Rather, the parameters object is stored as a whole in the builder's map with initialization parameters and can be accessed from there.
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 |
---|
FileBasedBuilderParametersImpl()
Creates a new instance of
FileBasedBuilderParametersImpl with an uninitialized FileHandler object. |
FileBasedBuilderParametersImpl(FileHandler handler)
Creates a new instance of
FileBasedBuilderParametersImpl and associates it with the given FileHandler
object. |
Modifier and Type | Method and Description |
---|---|
FileBasedBuilderParametersImpl |
clone()
Clones this object.
|
static FileBasedBuilderParametersImpl |
fromMap(Map<String,?> map)
Creates a new
FileBasedBuilderParametersImpl object from the content of the given map. |
static FileBasedBuilderParametersImpl |
fromParameters(Map<String,?> params)
Looks up an instance of this class in the specified parameters map.
|
static FileBasedBuilderParametersImpl |
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.
|
FileHandler |
getFileHandler()
Returns the
FileHandler managed by this object. |
Map<String,Object> |
getParameters()
Returns a map with all parameters defined by this objects.
|
ReloadingDetectorFactory |
getReloadingDetectorFactory()
Returns the
ReloadingDetectorFactory . |
Long |
getReloadingRefreshDelay()
Returns the refresh delay for reload operations.
|
void |
inheritFrom(Map<String,?> source)
Inherits properties from the specified map.
|
FileBasedBuilderParametersImpl |
setBasePath(String path)
Sets the base path of the associated
FileHandler . |
FileBasedBuilderParametersImpl |
setEncoding(String enc)
Sets the encoding of the associated
FileHandler . |
FileBasedBuilderParametersImpl |
setFile(File file)
Sets the location of the associated
FileHandler as a File object. |
FileBasedBuilderParametersImpl |
setFileName(String name)
Sets the file name of the associated
FileHandler . |
FileBasedBuilderParametersImpl |
setFileSystem(FileSystem fs)
Sets the
FileSystem of the associated FileHandler . |
FileBasedBuilderParametersImpl |
setLocationStrategy(FileLocationStrategy strategy)
Sets the
FileLocationStrategy for resolving the referenced file. |
FileBasedBuilderParametersImpl |
setPath(String path)
Sets the location of the associated
FileHandler as an absolute file path. |
FileBasedBuilderParametersImpl |
setReloadingDetectorFactory(ReloadingDetectorFactory reloadingDetectorFactory)
Sets the factory for creating
ReloadingDetector objects. |
FileBasedBuilderParametersImpl |
setReloadingRefreshDelay(Long reloadingRefreshDelay)
Sets the refresh delay for reloading support
|
FileBasedBuilderParametersImpl |
setURL(URL url)
Sets the location of the associated
FileHandler as a URL object. |
FileBasedBuilderParametersImpl |
setURL(URL url,
URLConnectionOptions urlConnectionOptions)
Sets the location of the associated
FileHandler as a URL object. |
copyPropertiesFrom, fetchBeanHelper, fetchInterpolatorSpecification, fetchProperty, merge, setBeanHelper, setConfigurationDecoder, setConversionHandler, setDefaultLookups, setInterpolator, setListDelimiterHandler, setLogger, setParentInterpolator, setPrefixLookups, setSynchronizer, setThrowExceptionOnMissing, storeProperty
public FileBasedBuilderParametersImpl()
FileBasedBuilderParametersImpl
with an uninitialized FileHandler
object.public FileBasedBuilderParametersImpl(FileHandler handler)
FileBasedBuilderParametersImpl
and associates it with the given FileHandler
object. If the handler is null, a new handler instance is created.handler
- the associated FileHandler
(can be null)public static FileBasedBuilderParametersImpl fromMap(Map<String,?> map)
FileBasedBuilderParametersImpl
object from the content of the given map. While
fromParameters()
expects that an object already exists and is stored in the given map, this method creates a
new instance based on the content of the map. The map can contain properties of a FileHandler
and some
additional settings which are stored directly in the newly created object. If the map is null, an
uninitialized instance is returned.map
- the map with properties (must not be null)ClassCastException
- if the map contains invalid datapublic static FileBasedBuilderParametersImpl fromParameters(Map<String,?> params)
fromParameters(params, false
;}params
- the map with parameters (must not be nullIllegalArgumentException
- if the map is nullpublic static FileBasedBuilderParametersImpl 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 returnedIllegalArgumentException
- if the map is nullpublic FileBasedBuilderParametersImpl clone()
ConfigurationInterpolator
or
Lookup
s are shared between this and the newly created instance. This implementation also creates a copy of the FileHandler
.clone
in class BasicBuilderParameters
public FileHandler getFileHandler()
FileHandler
managed by this object. This object is updated every time the file location is
changed.FileHandler
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. Of course, the properties
inherited from the base class are also added to the result map.getParameters
in interface BuilderParameters
getParameters
in class BasicBuilderParameters
public ReloadingDetectorFactory getReloadingDetectorFactory()
ReloadingDetectorFactory
. Result may be null which means that the default factory is to be
used.ReloadingDetectorFactory
public Long getReloadingRefreshDelay()
public 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 takes some properties defined in this class into account.inheritFrom
in class BasicBuilderParameters
source
- the source properties to inherit frompublic FileBasedBuilderParametersImpl setBasePath(String path)
FileBasedBuilderProperties
FileHandler
.setBasePath
in interface FileBasedBuilderProperties<FileBasedBuilderParametersImpl>
path
- the base pathpublic FileBasedBuilderParametersImpl setEncoding(String enc)
FileBasedBuilderProperties
FileHandler
.setEncoding
in interface FileBasedBuilderProperties<FileBasedBuilderParametersImpl>
enc
- the encodingpublic FileBasedBuilderParametersImpl setFile(File file)
FileBasedBuilderProperties
FileHandler
as a File
object.setFile
in interface FileBasedBuilderProperties<FileBasedBuilderParametersImpl>
file
- the File
locationpublic FileBasedBuilderParametersImpl setFileName(String name)
FileBasedBuilderProperties
FileHandler
.setFileName
in interface FileBasedBuilderProperties<FileBasedBuilderParametersImpl>
name
- the file namepublic FileBasedBuilderParametersImpl setFileSystem(FileSystem fs)
FileBasedBuilderProperties
FileSystem
of the associated FileHandler
.setFileSystem
in interface FileBasedBuilderProperties<FileBasedBuilderParametersImpl>
fs
- the FileSystem
public FileBasedBuilderParametersImpl setLocationStrategy(FileLocationStrategy strategy)
FileBasedBuilderProperties
FileLocationStrategy
for resolving the referenced file.setLocationStrategy
in interface FileBasedBuilderProperties<FileBasedBuilderParametersImpl>
strategy
- the FileLocationStrategy
public FileBasedBuilderParametersImpl setPath(String path)
FileBasedBuilderProperties
FileHandler
as an absolute file path.setPath
in interface FileBasedBuilderProperties<FileBasedBuilderParametersImpl>
path
- the path locationpublic FileBasedBuilderParametersImpl setReloadingDetectorFactory(ReloadingDetectorFactory reloadingDetectorFactory)
FileBasedBuilderProperties
ReloadingDetector
objects. With this method a custom factory for reloading
detectors can be installed. Per default, a factory creating FileHandlerReloadingDetector
objects is used.setReloadingDetectorFactory
in interface FileBasedBuilderProperties<FileBasedBuilderParametersImpl>
reloadingDetectorFactory
- the ReloadingDetectorFactory
public FileBasedBuilderParametersImpl setReloadingRefreshDelay(Long reloadingRefreshDelay)
FileBasedBuilderProperties
setReloadingRefreshDelay
in interface FileBasedBuilderProperties<FileBasedBuilderParametersImpl>
reloadingRefreshDelay
- the refresh delay (in milliseconds)public FileBasedBuilderParametersImpl setURL(URL url)
FileBasedBuilderProperties
FileHandler
as a URL
object.setURL
in interface FileBasedBuilderProperties<FileBasedBuilderParametersImpl>
url
- the URL
locationpublic FileBasedBuilderParametersImpl setURL(URL url, URLConnectionOptions urlConnectionOptions)
FileBasedBuilderProperties
FileHandler
as a URL
object.setURL
in interface FileBasedBuilderProperties<FileBasedBuilderParametersImpl>
url
- the URL
locationurlConnectionOptions
- optionsCopyright © 2001–2022 The Apache Software Foundation. All rights reserved.