public interface ConfigurationBuilder
Configuration.
Builders can be obtained in exactly two ways:
Configuration,
by calling Configuration.toBuilder().ConfigurationProvider.getConfigurationBuilder().Configuration instance can
be created and can be applied by calling
build()}.| Modifier and Type | Method | Description |
|---|---|---|
ConfigurationBuilder |
addDefaultPropertyConverters() |
Add all auto-discoverable property converters to the context built.
|
ConfigurationBuilder |
addDefaultPropertyFilters() |
Add all auto-discoverable property filters to the context built.
|
ConfigurationBuilder |
addDefaultPropertySources() |
Adds all registered (default) property sources to the context built.
|
<T> ConfigurationBuilder |
addPropertyConverters(TypeLiteral<T> typeToConvert,
Collection<PropertyConverter<T>> propertyConverters) |
This method can be used for adding
PropertyConverters. |
default <T> ConfigurationBuilder |
addPropertyConverters(TypeLiteral<T> typeToConvert,
PropertyConverter<T>... propertyConverters) |
This method can be used for adding
PropertyConverters. |
ConfigurationBuilder |
addPropertyFilters(Collection<PropertyFilter> filters) |
Adds the given
PropertyFilter instances, hereby the instances are added
to the end of the createList with highest priority. |
default ConfigurationBuilder |
addPropertyFilters(PropertyFilter... filters) |
Adds the given
PropertyFilter instances, hereby the instances are added
to the end of the createList with highest priority. |
ConfigurationBuilder |
addPropertySources(Collection<PropertySource> propertySources) |
This method can be used for programmatically adding
PropertySources. |
default ConfigurationBuilder |
addPropertySources(PropertySource... propertySources) |
This method can be used for adding
PropertySources. |
Configuration |
build() |
Builds a new
Configuration based on the data in this builder. |
ConfigurationBuilder |
decreasePriority(PropertySource propertySource) |
Decreases the priority of the given property source, by moving it towards the start
of the chain of property sources.
|
ClassLoader |
getClassLoader() |
Get the classloader used by this builder.
|
Map<TypeLiteral<?>,List<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.
|
ConfigurationBuilder |
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.
|
ConfigurationBuilder |
increasePriority(PropertySource propertySource) |
Increases the priority of the given property source, by moving it towards the end
of the chain of property sources.
|
ConfigurationBuilder |
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.
|
ConfigurationBuilder |
removePropertyConverters(TypeLiteral<?> typeToConvert) |
Removes all converters for the given type, which actually renders a given type
unsupported for type conversion.
|
<T> ConfigurationBuilder |
removePropertyConverters(TypeLiteral<T> typeToConvert,
Collection<PropertyConverter<T>> propertyConverters) |
Removes the given PropertyConverter instances for the given type,
if existing.
|
default <T> ConfigurationBuilder |
removePropertyConverters(TypeLiteral<T> typeToConvert,
PropertyConverter<T>... propertyConverters) |
Removes the given
PropertyConverter instances for the given type,
if existing. |
ConfigurationBuilder |
removePropertyFilters(Collection<PropertyFilter> filter) |
Removes the given
PropertyFilter instances, if existing. |
default ConfigurationBuilder |
removePropertyFilters(PropertyFilter... filters) |
Removes the given
PropertyFilter instances, if existing. |
ConfigurationBuilder |
removePropertySources(Collection<PropertySource> propertySources) |
Removes the given property sources, if existing.
|
default ConfigurationBuilder |
removePropertySources(PropertySource... propertySources) |
Removes the given property sources, if existing.
|
ConfigurationBuilder |
setClassLoader(ClassLoader classLoader) |
Set the classloader to be used for loading of configuration resources, equals to
setServiceContext(ServiceContextManager.getServiceContext(classLoader)). |
default ConfigurationBuilder |
setConfiguration(Configuration config) |
Init this builder instance with the given
Configuration instance. |
ConfigurationBuilder |
setContext(ConfigurationContext context) |
Init this builder instance with the given
ConfigurationContext instance. |
ConfigurationBuilder |
setMeta(String property,
String key,
String value) |
Adds (overrides existing value) the given sources as property sources.
|
ConfigurationBuilder |
setMeta(String property,
Map<String,String> metaData) |
Adds (overrides existing value with same same keys) the given sources as property sources.
|
ConfigurationBuilder |
setServiceContext(ServiceContext serviceContext) |
Sets the ServiceContext to be used.
|
ConfigurationBuilder |
sortPropertyConverter(Comparator<PropertyConverter> comparator) |
Sorts the current registered property converters using the given comparator.
|
ConfigurationBuilder |
sortPropertyFilter(Comparator<PropertyFilter> comparator) |
Sorts the current registered property filters using the given comparator.
|
ConfigurationBuilder |
sortPropertySources(Comparator<PropertySource> comparator) |
Sorts the current registered property sources using the given comparator.
|
ConfigurationBuilder setClassLoader(ClassLoader classLoader)
setServiceContext(ServiceContextManager.getServiceContext(classLoader)).classLoader - the classloader, not null.getClassLoader()ClassLoader getClassLoader()
setClassLoader(ClassLoader)ConfigurationBuilder setServiceContext(ServiceContext serviceContext)
serviceContext - the serviceContext, nuo null.default ConfigurationBuilder setConfiguration(Configuration config)
Configuration instance. This
method will use any existing property sources, filters, converters and the combination
policy of the given Configuration and initialize the current builder
with them. All previous property sources, filters, converters and the combination
policy of this instance will be replaced.config - the Configuration instance to be used, not null.ConfigurationBuilder 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. All previous property sources, filters, converters and the combination
policy of this instance will be replaced.context - the ConfigurationContext instance to be used, not null.default ConfigurationBuilder 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 addPropertyValueIllegalArgumentException - If a property source with a given name already
exists.ConfigurationBuilder setMeta(String property, String key, String value)
property - the property key, not null,key - the key, not null.value - the value, not null.ConfigurationBuilder setMeta(String property, Map<String,String> metaData)
property - the property key, not null,metaData - the metadata, not null.ConfigurationBuilder 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 addPropertyValueIllegalArgumentException - If a property source with a given name already
exists.ConfigurationBuilder addDefaultPropertySources()
default ConfigurationBuilder removePropertySources(PropertySource... propertySources)
propertySources - the property sources to remove, not null.ConfigurationBuilder removePropertySources(Collection<PropertySource> propertySources)
propertySources - the property sources to remove, not null.List<PropertySource> getPropertySources()
null.List<PropertyFilter> getPropertyFilters()
null.Map<TypeLiteral<?>,List<PropertyConverter<?>>> getPropertyConverter()
ConfigurationBuilder increasePriority(PropertySource propertySource)
propertySource - the property source to be incresed regarding its significance.IllegalArgumentException - If no such property source exists in the current
chain.ConfigurationBuilder decreasePriority(PropertySource propertySource)
propertySource - the property source to be decresed regarding its significance.IllegalArgumentException - If no such property source exists in the current
chain.ConfigurationBuilder highestPriority(PropertySource propertySource)
propertySource - the property source to be maximized regarding its significance.IllegalArgumentException - If no such property source exists in the current
chain.ConfigurationBuilder lowestPriority(PropertySource propertySource)
propertySource - the property source to be minimized regarding its significance.IllegalArgumentException - If no such property source exists in the current
chain.default ConfigurationBuilder addPropertyFilters(PropertyFilter... filters)
PropertyFilter instances, hereby the instances are added
to the end of the createList with highest priority. The ordering of existing
property filters remains unchanged. To sort the property
filters call sortPropertyFilter(java.util.Comparator<org.apache.tamaya.spi.PropertyFilter>).filters - the filters to addPropertyValueConfigurationBuilder addPropertyFilters(Collection<PropertyFilter> filters)
PropertyFilter instances, hereby the instances are added
to the end of the createList with highest priority. The ordering of existing
property filters remains unchanged. To sort the property
filters call sortPropertyFilter(java.util.Comparator<org.apache.tamaya.spi.PropertyFilter>).filters - the filters to addPropertyValueConfigurationBuilder addDefaultPropertyFilters()
default ConfigurationBuilder removePropertyFilters(PropertyFilter... filters)
PropertyFilter instances, if existing. The order of the remaining
filters is preserved.filters - the filter to removeConfigurationBuilder removePropertyFilters(Collection<PropertyFilter> filter)
PropertyFilter instances, if existing. The order of the remaining
filters is preserved.filter - the filter to removedefault <T> ConfigurationBuilder 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 usedpropertyConverters - the PropertyConverters to addPropertyValue for this type<T> ConfigurationBuilder 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 usedpropertyConverters - the PropertyConverters to addPropertyValue for this typeConfigurationBuilder addDefaultPropertyConverters()
default <T> ConfigurationBuilder removePropertyConverters(TypeLiteral<T> typeToConvert, PropertyConverter<T>... propertyConverters)
PropertyConverter instances for the given type,
if existing.T - the target type.typeToConvert - the type which the converter is usedpropertyConverters - the converter to remove<T> ConfigurationBuilder removePropertyConverters(TypeLiteral<T> typeToConvert, Collection<PropertyConverter<T>> propertyConverters)
T - the target type.typeToConvert - the type which the converter is usedpropertyConverters - the converter to removeConfigurationBuilder removePropertyConverters(TypeLiteral<?> typeToConvert)
typeToConvert - the type which the converter is usedConfigurationBuilder sortPropertySources(Comparator<PropertySource> comparator)
NOTE: property sources at the beginning have minimal significance.
comparator - the comparator to be used, not null.ConfigurationBuilder sortPropertyFilter(Comparator<PropertyFilter> comparator)
NOTE: property filters at the beginning have minimal significance.
comparator - the comparator to be used, not null.ConfigurationBuilder sortPropertyConverter(Comparator<PropertyConverter> comparator)
NOTE: property converters at the beginning have minimal significance.
comparator - the comparator to be used, not null.Configuration build()
Configuration 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 use sortPropertyFilter(Comparator) and/or sortPropertySources(Comparator)
before building the context.Copyright © 2014–2019 Apache Software Foundation. All rights reserved.