public interface ConfigurationContextBuilder
ConfigurationContext.
Builders can be obtained in exactly two ways:
ConfigurationContext,
by calling ConfigurationContext.toBuilder().ConfigurationProvider.getConfigurationContextBuilder().ConfigurationContext instance can
be created and can be applied by calling
ConfigurationProvider.setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext).| Modifier and Type | Method and Description |
|---|---|
ConfigurationContextBuilder |
addDefaultPropertyConverters()
Add all registered (default) property converters to the context built.
|
ConfigurationContextBuilder |
addDefaultPropertyFilters()
Add all registered (default) property filters to the context built.
|
ConfigurationContextBuilder |
addDefaultPropertySources()
Add all registered (default) property sources to the context built.
|
<T> ConfigurationContextBuilder |
addPropertyConverters(TypeLiteral<T> typeToConvert,
Collection<PropertyConverter<T>> propertyConverters)
This method can be used for adding
PropertyConverters. |
<T> ConfigurationContextBuilder |
addPropertyConverters(TypeLiteral<T> typeToConvert,
PropertyConverter<T>... propertyConverters)
This method can be used for adding
PropertyConverters. |
ConfigurationContextBuilder |
addPropertyFilters(Collection<PropertyFilter> filters)
Adds the given PropertyFilter instances, hereby the instances are added
to the end of the list with highest priority.
|
ConfigurationContextBuilder |
addPropertyFilters(PropertyFilter... filters)
Adds the given PropertyFilter instances, hereby the instances are added
to the end of the list with highest priority.
|
ConfigurationContextBuilder |
addPropertySources(Collection<PropertySource> propertySources)
This method can be used for programmatically adding
PropertySources. |
ConfigurationContextBuilder |
addPropertySources(PropertySource... propertySources)
This method can be used for adding
PropertySources. |
ConfigurationContext |
build()
Builds a new
ConfigurationContext based on the data in this builder. |
ConfigurationContextBuilder |
decreasePriority(PropertySource propertySource)
Decreases the priority of the given property source, by moving it towards the start
of the chain of property sources.
|
Map<TypeLiteral<?>,Collection<PropertyConverter<?>>> |
getPropertyConverter()
Access the current registered property converters.
|
List<PropertyFilter> |
getPropertyFilters()
Access the current chain of property filters.
|
List<PropertySource> |
getPropertySources()
Access the current chain of property sources.
|
ConfigurationContextBuilder |
highestPriority(PropertySource propertySource)
Increases the priority of the given property source to be maximal, by moving it to
the tail of the of property source chain.
|
ConfigurationContextBuilder |
increasePriority(PropertySource propertySource)
Increases the priority of the given property source, by moving it towards the end
of the chain of property sources.
|
ConfigurationContextBuilder |
lowestPriority(PropertySource propertySource)
Decreases the priority of the given property source to be minimal, by moving it to
the start of the chain of property source chain.
|
ConfigurationContextBuilder |
removePropertyConverters(TypeLiteral<?> typeToConvert)
Removes all converters for the given type, which actually renders a given type
unsupported for type conversion.
|
<T> ConfigurationContextBuilder |
removePropertyConverters(TypeLiteral<T> typeToConvert,
Collection<PropertyConverter<T>> propertyConverters)
Removes the given PropertyConverter instances for the given type,
if existing.
|
<T> ConfigurationContextBuilder |
removePropertyConverters(TypeLiteral<T> typeToConvert,
PropertyConverter<T>... propertyConverters)
Removes the given PropertyConverter instances for the given type,
if existing.
|
ConfigurationContextBuilder |
removePropertyFilters(Collection<PropertyFilter> filters)
Removes the given PropertyFilter instances, if existing.
|
ConfigurationContextBuilder |
removePropertyFilters(PropertyFilter... filters)
Removes the given PropertyFilter instances, if existing.
|
ConfigurationContextBuilder |
removePropertySources(Collection<PropertySource> propertySources)
Removes the given property sources, if existing.
|
ConfigurationContextBuilder |
removePropertySources(PropertySource... propertySources)
Removes the given property sources, if existing.
|
ConfigurationContextBuilder |
setContext(ConfigurationContext context)
Init this builder instance with the given
ConfigurationContext instance. |
ConfigurationContextBuilder |
setPropertyValueCombinationPolicy(PropertyValueCombinationPolicy policy)
Sets the
PropertyValueCombinationPolicy used to evaluate the final
property values. |
ConfigurationContextBuilder |
sortPropertyFilter(Comparator<PropertyFilter> comparator)
Sorts the current registered property filters using the given comparator.
|
ConfigurationContextBuilder |
sortPropertySources(Comparator<PropertySource> comparator)
Sorts the current registered property sources using the given comparator.
|
ConfigurationContextBuilder setContext(ConfigurationContext context)
ConfigurationContext instance. This
method will use any existing property sources, filters, converters and the combination
policy of the given ConfigurationContext and initialize the current builder
with them.context - the ConfigurationContext instance to be used, not null.ConfigurationContextBuilder addPropertySources(PropertySource... propertySources)
PropertySources.
Hereby the property source is added to the tail of property sources with
lowest priority regardless of its current ordinal value. To sort the property
sources based on their ordinals call sortPropertySources(java.util.Comparator<org.apache.tamaya.spi.PropertySource>).propertySources - the PropertySources to addIllegalArgumentException - If a property source with a given name already
exists.ConfigurationContextBuilder addPropertySources(Collection<PropertySource> propertySources)
PropertySources.
Hereby the property source is added to the tail of property sources with
lowest priority regardless of its current ordinal value. To sort the property
sources based on their ordinals call sortPropertySources(java.util.Comparator<org.apache.tamaya.spi.PropertySource>).propertySources - the PropertySources to addIllegalArgumentException - If a property source with a given name already
exists.ConfigurationContextBuilder addDefaultPropertySources()
ConfigurationContextBuilder removePropertySources(PropertySource... propertySources)
propertySources - the property sources to remove, not null.ConfigurationContextBuilder removePropertySources(Collection<PropertySource> propertySources)
propertySources - the property sources to remove, not null.List<PropertySource> getPropertySources()
null.List<PropertyFilter> getPropertyFilters()
null.Map<TypeLiteral<?>,Collection<PropertyConverter<?>>> getPropertyConverter()
ConfigurationContextBuilder increasePriority(PropertySource propertySource)
propertySource - the property source to be incresed regarding its significance.IllegalArgumentException - If no such property source exists in the current
chain.ConfigurationContextBuilder decreasePriority(PropertySource propertySource)
propertySource - the property source to be decresed regarding its significance.IllegalArgumentException - If no such property source exists in the current
chain.ConfigurationContextBuilder highestPriority(PropertySource propertySource)
propertySource - the property source to be maximized regarding its significance.IllegalArgumentException - If no such property source exists in the current
chain.ConfigurationContextBuilder lowestPriority(PropertySource propertySource)
propertySource - the property source to be minimized regarding its significance.IllegalArgumentException - If no such property source exists in the current
chain.ConfigurationContextBuilder addPropertyFilters(PropertyFilter... filters)
sortPropertyFilter(java.util.Comparator<org.apache.tamaya.spi.PropertyFilter>).filters - the filters to addConfigurationContextBuilder addPropertyFilters(Collection<PropertyFilter> filters)
sortPropertyFilter(java.util.Comparator<org.apache.tamaya.spi.PropertyFilter>).filters - the filters to addConfigurationContextBuilder addDefaultPropertyFilters()
ConfigurationContextBuilder removePropertyFilters(PropertyFilter... filters)
filters - the filter to removeConfigurationContextBuilder removePropertyFilters(Collection<PropertyFilter> filters)
filters - the filter to remove<T> ConfigurationContextBuilder addPropertyConverters(TypeLiteral<T> typeToConvert, PropertyConverter<T>... propertyConverters)
PropertyConverters.
Converters are added at the end after any existing converters.
For converters already registered for the current target type the
method has no effect.T - the target type.typeToConvert - the type for which the converter is forpropertyConverters - the PropertyConverters to add for this type<T> ConfigurationContextBuilder addPropertyConverters(TypeLiteral<T> typeToConvert, Collection<PropertyConverter<T>> propertyConverters)
PropertyConverters.
Converters are added at the end after any existing converters.
For converters already registered for the current target type the
method has no effect.T - the target type.typeToConvert - the type for which the converter is forpropertyConverters - the PropertyConverters to add for this typeConfigurationContextBuilder addDefaultPropertyConverters()
<T> ConfigurationContextBuilder removePropertyConverters(TypeLiteral<T> typeToConvert, PropertyConverter<T>... propertyConverters)
T - the target type.typeToConvert - the type which the converter is forpropertyConverters - the converter to remove<T> ConfigurationContextBuilder removePropertyConverters(TypeLiteral<T> typeToConvert, Collection<PropertyConverter<T>> propertyConverters)
T - the target type.typeToConvert - the type which the converter is forpropertyConverters - the converter to removeConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert)
typeToConvert - the type which the converter is forConfigurationContextBuilder sortPropertySources(Comparator<PropertySource> comparator)
comparator - the comparator to be used, not null.ConfigurationContextBuilder sortPropertyFilter(Comparator<PropertyFilter> comparator)
comparator - the comparator to be used, not null.ConfigurationContextBuilder setPropertyValueCombinationPolicy(PropertyValueCombinationPolicy policy)
PropertyValueCombinationPolicy used to evaluate the final
property values.policy - the PropertyValueCombinationPolicy used, not null.ConfigurationContext build()
ConfigurationContext based on the data in this builder. The ordering of property
sources and property filters is not changed, regardless of their ordinals. For ensure a certain
ordering/significance call sortPropertyFilter(Comparator) and/or sortPropertySources(Comparator)
before building the context.ConfigurationProvider.createConfiguration(ConfigurationContext)Copyright © 2014–2017 Apache Software Foundation. All rights reserved.