@Priority(value=100) public class CLAwareConfigurationContext extends Object implements ConfigurationContext
Constructor and Description |
---|
CLAwareConfigurationContext() |
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> targetType)
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. |
public void addPropertySources(PropertySource... propertySourcesToAdd)
ConfigurationContext
PropertySource
s.
It is not needed for normal 'usage' by end users, but only for Extension Developers!addPropertySources
in interface ConfigurationContext
propertySourcesToAdd
- the PropertySources to addpublic List<PropertySource> getPropertySources()
ConfigurationContext
getPropertySources
in interface ConfigurationContext
public <T> void addPropertyConverter(TypeLiteral<T> typeToConvert, PropertyConverter<T> propertyConverter)
ConfigurationContext
PropertyConverter
s.
It is not needed for normal 'usage' by end users, but only for Extension Developers!addPropertyConverter
in interface ConfigurationContext
T
- the type of the type literaltypeToConvert
- the type which the converter is forpropertyConverter
- the PropertyConverters to add for this typepublic Map<TypeLiteral<?>,List<PropertyConverter<?>>> getPropertyConverters()
ConfigurationContext
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} }
getPropertyConverters
in interface ConfigurationContext
public <T> List<PropertyConverter<T>> getPropertyConverters(TypeLiteral<T> targetType)
ConfigurationContext
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.
getPropertyConverters
in interface ConfigurationContext
T
- the type of the type literaltargetType
- type of the desired converterpublic List<PropertyFilter> getPropertyFilters()
ConfigurationContext
getPropertyFilters
in interface ConfigurationContext
public PropertyValueCombinationPolicy getPropertyValueCombinationPolicy()
ConfigurationContext
PropertyValueCombinationPolicy
used to evaluate the final
property values.getPropertyValueCombinationPolicy
in interface ConfigurationContext
PropertyValueCombinationPolicy
used, never null.public ConfigurationContextBuilder toBuilder()
ConfigurationContext
ConfigurationContextBuilder
preinitialized with the data from this instance.toBuilder
in interface ConfigurationContext
Copyright © 2014–2016 Apache Software Foundation. All rights reserved.