public class PropertiesConfiguration extends AbstractResourceLoadingConfiguration<Properties> implements Ranked, Serializable
AbstractResourceLoadingConfiguration
that gets configuration property
values from Properties
resources.AbstractResourceLoadingConfiguration.Resource<T>
Constructor and Description |
---|
PropertiesConfiguration(Function<? super Map<? extends String,? extends String>,? extends AbstractResourceLoadingConfiguration.Resource<? extends Properties>> resourceLoader)
Creates a new
PropertiesConfiguration . |
Modifier and Type | Method and Description |
---|---|
Set<String> |
getNames(AbstractResourceLoadingConfiguration.Resource<? extends Properties> propertiesResource) |
protected int |
getRank(AbstractResourceLoadingConfiguration.Resource<? extends Properties> resource) |
protected ConfigurationValue |
getValue(AbstractResourceLoadingConfiguration.Resource<? extends Properties> propertiesResource,
Map<String,String> requestedCoordinates,
String name)
Returns a
ConfigurationValue suitable for the supplied
name normally sourced in some fashion from the supplied
AbstractResourceLoadingConfiguration.Resource , or null if no such ConfigurationValue can be found. |
getNames, getRank, getValue
getConfigurations, setConfigurations
public PropertiesConfiguration(Function<? super Map<? extends String,? extends String>,? extends AbstractResourceLoadingConfiguration.Resource<? extends Properties>> resourceLoader)
PropertiesConfiguration
.resourceLoader
- a Function
that accepts a Map
of requested configuration coordinates and returns a Resource
that can supply a Properties
object to serve as a source of configuration values
for use by the AbstractResourceLoadingConfiguration.getValue(Resource, Map, String)
method;
may be null
in which case all invocations of the AbstractResourceLoadingConfiguration.getValue(Map, String)
method will return null
AbstractResourceLoadingConfiguration.getValue(Resource, Map, String)
,
Resource
protected ConfigurationValue getValue(AbstractResourceLoadingConfiguration.Resource<? extends Properties> propertiesResource, Map<String,String> requestedCoordinates, String name)
ConfigurationValue
suitable for the supplied
name
normally sourced in some fashion from the supplied
AbstractResourceLoadingConfiguration.Resource
, or null
if no such ConfigurationValue
can be found.
Implementations of this method are permitted to return null
.
Implementations of this method must not call the AbstractResourceLoadingConfiguration.getValue(Map, String)
method or undefined behavior will
result.
This implementation gets a Properties
object
from the supplied
Resource
and uses it, plus the configuration coordinates supplied by
the supplied Resource
, to construct and return a
suitable ConfigurationValue
.
getValue
in class AbstractResourceLoadingConfiguration<Properties>
propertiesResource
- a Resource
that can supply a Properties
object to serve as
the ultimate source of configuration values for the requested
coordinates; must not be null
requestedCoordinates
- for convenience, the same Map
supplied to the AbstractResourceLoadingConfiguration.getValue(Map, String)
method is supplied
here representing the configuration coordinates for which a value
is requested; note that these may very well be different from
the configuration
coordinates actually pertaining to the resource; most
implementations will not need to reference this parametername
- the name of the configuration property for which a
value is to be sought; must not be null
ConfigurationValue
or null
NullPointerException
- if resource
or name
is null
AbstractResourceLoadingConfiguration.getValue(Map, String)
,
Resource
public Set<String> getNames(AbstractResourceLoadingConfiguration.Resource<? extends Properties> propertiesResource)
getNames
in class AbstractResourceLoadingConfiguration<Properties>
protected int getRank(AbstractResourceLoadingConfiguration.Resource<? extends Properties> resource)
getRank
in class AbstractResourceLoadingConfiguration<Properties>
Copyright © 2017–2019, microBean. All rights reserved.