public interface ConfigurationContext
PropertySource
s,
managing PropertyConverter
s, ConfigFilters, etc.Modifier and Type | Method and Description |
---|---|
<T> void |
addPropertyConverter(TypeLiteral<T> typeToConvert,
PropertyConverter<T> propertyConverter)
This method can be used for programmatically adding
PropertyConverter s. |
void |
addPropertySources(PropertySource... propertySourcesToAdd)
This method can be used for programmatically adding
PropertySource s. |
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.
|
List<PropertySource> |
getPropertySources()
This method returns the current list of registered PropertySources ordered via their ordinal.
|
PropertyValueCombinationPolicy |
getPropertyValueCombinationPolicy()
Access the
PropertyValueCombinationPolicy used to evaluate the final
property values. |
ConfigurationContextBuilder |
toBuilder()
Creates a
ConfigurationContextBuilder preinitialized with the data from this instance. |
void addPropertySources(PropertySource... propertySourcesToAdd)
PropertySource
s.
It is not needed for normal 'usage' by end users, but only for Extension Developers!propertySourcesToAdd
- the PropertySources to addList<PropertySource> getPropertySources()
<T> void addPropertyConverter(TypeLiteral<T> typeToConvert, PropertyConverter<T> propertyConverter)
PropertyConverter
s.
It is not needed for normal 'usage' by end users, but only for Extension Developers!T
- the type of the type literaltypeToConvert
- the type which the converter is forpropertyConverter
- the PropertyConverters to add for this typeMap<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
cladd name.
A simplified scenario could be like:
{ Date.class -> {StandardDateConverter, TimezoneDateConverter, MyCustomDateConverter } Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter} Integer.class -> {DynamicDefaultConverter} }
<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 PropertyConverter have the same ordinal number they will get 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), valueOf(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 converter that is able to convert the configured value, 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 converterList<PropertyFilter> getPropertyFilters()
PropertyValueCombinationPolicy getPropertyValueCombinationPolicy()
PropertyValueCombinationPolicy
used to evaluate the final
property values.PropertyValueCombinationPolicy
used, never null.ConfigurationContextBuilder toBuilder()
ConfigurationContextBuilder
preinitialized with the data from this instance.Copyright © 2014–2016 Apache Software Foundation. All rights reserved.