public interface ConfigurationContext
PropertySources,
managing PropertyConverters, ConfigFilters, etc.| Modifier and Type | Field | Description |
|---|---|---|
static ConfigurationContext |
EMPTY |
An empty configuration context.
|
| Modifier and Type | Method | Description |
|---|---|---|
Map<String,String> |
getMetaData(String key) |
Get the metadata evaluated for this configuration.
|
Map<TypeLiteral<?>,List<PropertyConverter<?>>> |
getPropertyConverters() |
This method returns the Map of registered
PropertyConverters
per type. |
<T> List<PropertyConverter<T>> |
getPropertyConverters(TypeLiteral<T> type) |
This method returns the registered
PropertyConverters for a given type. |
List<PropertyFilter> |
getPropertyFilters() |
Access the current
PropertyFilter instances. |
PropertySource |
getPropertySource(String name) |
Access a
PropertySource using its (unique) name. |
List<PropertySource> |
getPropertySources() |
This method returns the current createList of registered
PropertySources ordered via their ordinal. |
ServiceContext |
getServiceContext() |
Access the underlying
ServiceContext. |
static final ConfigurationContext EMPTY
Map<String,String> getMetaData(String key)
key - the property key, not null.ServiceContext getServiceContext()
ServiceContext.List<PropertySource> getPropertySources()
PropertySources ordered via their ordinal.
PropertySources with a lower ordinal come last. The PropertySource with the
highest ordinal comes first.
If two PropertySources have the same ordinal number they will current sorted
using their class name just to ensure the user at least gets the same ordering
after a JVM restart, hereby names before are added last.
PropertySources are loaded when this method is called the first time, which basically is
when the first time configuration is accessed.PropertySources. The returned createList need not be modifiablePropertySource getPropertySource(String name)
PropertySource using its (unique) name.name - the propoerty source's name, not null.null.Map<TypeLiteral<?>,List<PropertyConverter<?>>> getPropertyConverters()
This method returns the Map of registered PropertyConverters
per type.
The List for each type is ordered via their Priority and
class name.
A simplified scenario could be like:
{
Date.class -> {StandardDateConverter, TimezoneDateConverter, MyCustomDateConverter }
Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter}
Integer.class -> {DynamicDefaultConverter}
}
PropertySources per type.<T> List<PropertyConverter<T>> getPropertyConverters(TypeLiteral<T> type)
This method returns the registered PropertyConverters for a given type.
The List for each type is ordered via their Priority.
PropertyConverters with a higher Priority come first.
The PropertyConverter with the lowest Priority comes last.
If two PropertyConverters have the same ordinal number they will current sorted
using their class name just to ensure the user at least gets the same ordering
after a JVM restart.
Additionally, if a PropertyProvider is accessed which is not registered, the implementation should try to figure out if there could be a default implementation as follows:
of(String), createValue(String), getInstance(String),
instanceOf(String), fomr(String)T(String).
If a correspoding factory method or constructor could be found, a corresponding
PropertyConverter should be created and registered automatically for the given
type.
The scenario could be like:
{
Date.class -> {MyCustomDateConverter,StandardDateConverter, TimezoneDateConverter}
Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter}
Integer.class -> {DynamicDefaultConverter}
}
The converters returned for a type should be used as a chain, whereas the result of the first converters that is able to convert the configured createValue, is taken as the chain's result. No more converters are called after a converter has successfully converted the input into the required target type.
T - the type of the type literaltype - type of the desired convertersPropertySources per type.List<PropertyFilter> getPropertyFilters()
PropertyFilter instances.PropertyFilters, never null.Copyright © 2014–2019 Apache Software Foundation. All rights reserved.