public abstract class AbstractResourceLoadingConfiguration<T> extends AbstractConfiguration implements Ranked
AbstractConfiguration that flexibly loads some kind of
resource, or uses a previously loaded one, to satisfy demands for
configuration property values.| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractResourceLoadingConfiguration.Resource<T>
A
Supplier of a particular kind of resource from which
configuration property values may be retrieved. |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractResourceLoadingConfiguration(Function<? super Map<? extends String,? extends String>,? extends AbstractResourceLoadingConfiguration.Resource<? extends T>> resourceLoader)
Creates a new
AbstractResourceLoadingConfiguration. |
| Modifier and Type | Method and Description |
|---|---|
Set<String> |
getNames()
|
protected abstract Set<String> |
getNames(AbstractResourceLoadingConfiguration.Resource<? extends T> resource) |
int |
getRank() |
protected int |
getRank(AbstractResourceLoadingConfiguration.Resource<? extends T> resource) |
protected abstract ConfigurationValue |
getValue(AbstractResourceLoadingConfiguration.Resource<? extends T> resource,
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. |
ConfigurationValue |
getValue(Map<String,String> coordinates,
String name)
Returns a
ConfigurationValue suitable for the supplied
configurationCoordinates and name, or null if there is no suitable value. |
getConfigurations, setConfigurationsprotected AbstractResourceLoadingConfiguration(Function<? super Map<? extends String,? extends String>,? extends AbstractResourceLoadingConfiguration.Resource<? extends T>> resourceLoader)
AbstractResourceLoadingConfiguration.resourceLoader - a Function that accepts a Map of requested configuration coordinates and returns a AbstractResourceLoadingConfiguration.Resource that can supply a source of
configuration values for use by the getValue(Resource,
Map, String) method; may be null in which case all
invocations of the getValue(Map, String) method will
return nullgetValue(Resource, Map, String),
getValue(Map, String),
AbstractResourceLoadingConfiguration.Resourceprotected int getRank(AbstractResourceLoadingConfiguration.Resource<? extends T> resource)
public ConfigurationValue getValue(Map<String,String> coordinates, String name)
ConfigurationValue suitable for the supplied
configurationCoordinates and name, or null if there is no suitable value.
Implementations of this method may return null.
The ConfigurationValue that is returned must
have a name that is
equal to the supplied name.
The ConfigurationValue that is returned must be
created with this Configuration as the first parameter value supplied to its
constructor.
The ConfigurationValue that is returned must be
created with a set of configuration
coordinates that is a subset of the supplied configurationCoordinates.
This implementation calls the getValue(Resource, Map,
String) method with the return value resulting from the
invocation of the Function supplied at construction
time.
getValue in interface Configurationcoordinates - the requested configuration coordinates; may be nullname - the name of a configuration property for which a
value should be returned; must not be nullConfigurationValue suitable for the supplied
configurationCoordinates and name, or nullNullPointerException - if name is nullgetValue(Resource, Map, String)public Set<String> getNames()
ConfigurationSet of the names of all ConfigurationValues that might be returned by this Configuration.
Implementations of this method must not return null.
Just because a name appears in the returned Set does
not mean that a ConfigurationValue will be
returned for it in a location in configuration space identified
by any arbitrary set of configuration coordinates.
getNames in interface Configurationnull Set of namesprotected abstract ConfigurationValue getValue(AbstractResourceLoadingConfiguration.Resource<? extends T> resource, 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 getValue(Map, String) method or undefined behavior will
result.
resource - a AbstractResourceLoadingConfiguration.Resource hopefully providing access to
the ultimate source of configuration values for the requested
coordinates; must not be nullrequestedCoordinates - for convenience, the same Map
supplied to the 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 nullConfigurationValue or nullNullPointerException - if resource or name is nullgetValue(Map, String),
AbstractResourceLoadingConfiguration.Resourceprotected abstract Set<String> getNames(AbstractResourceLoadingConfiguration.Resource<? extends T> resource)
Copyright © 2017–2019, microBean. All rights reserved.