Merge remote-tracking branch 'origin/master' into configjsr
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/cd37ae9c Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/cd37ae9c Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/cd37ae9c Branch: refs/heads/configjsr Commit: cd37ae9c4aae265a5dd2435240b8ca93759c4fd6 Parents: 97bd06a d6229de Author: Phil Ottlinger <[email protected]> Authored: Thu Jan 25 23:04:16 2018 +0100 Committer: Phil Ottlinger <[email protected]> Committed: Thu Jan 25 23:04:16 2018 +0100 ---------------------------------------------------------------------- README.md | 7 +++++ .../apache/tamaya/ConfigurationProvider.java | 4 +-- .../java/org/apache/tamaya/Configuration.java | 32 ++++++++++---------- .../apache/tamaya/spi/ConfigurationBuilder.java | 9 +++--- pom.xml | 18 +++++------ 5 files changed, 38 insertions(+), 32 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cd37ae9c/code/compat/src/main/java/org/apache/tamaya/ConfigurationProvider.java ---------------------------------------------------------------------- diff --cc code/compat/src/main/java/org/apache/tamaya/ConfigurationProvider.java index bacb944,0000000..9eae5af mode 100644,000000..100644 --- a/code/compat/src/main/java/org/apache/tamaya/ConfigurationProvider.java +++ b/code/compat/src/main/java/org/apache/tamaya/ConfigurationProvider.java @@@ -1,138 -1,0 +1,138 @@@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tamaya; + +import org.apache.tamaya.spi.*; + +import java.util.logging.Logger; + +/** - * Static access to the {@link Configuration} for the very application. ++ * Static access to the {@link Configuration} of the whole application. + */ +public final class ConfigurationProvider { + + private static final Logger LOG = Logger.getLogger(ConfigurationProvider.class.getName()); + + private static ConfigurationProviderSpi spi() { + ConfigurationProviderSpi spi = ServiceContextManager.getServiceContext() + .getService(ConfigurationProviderSpi.class); + if(spi==null){ + throw new IllegalStateException("ConfigurationProviderSpi not available."); + } + return spi; + } + + private ConfigurationProvider() { + // just to prevent initialisation + } + + /** + * Access the current configuration. + * + * @return the corresponding Configuration instance, never {@code null}. + */ + public static Configuration getConfiguration() { + return spi().getConfiguration(); + } + + /** + * Creates a new configuration instance based on the given context. + * + * @param context the configuration context, not {@code null}. + * @return a new Configuration instance, never {@code null}. + */ + public static Configuration createConfiguration(ConfigurationContext context) { + return spi().createConfiguration(context); + } + + /** + * Get access to the current ConfigurationContext. + * + * @return the current ConfigurationContext, never null. - * @deprecated Use {@link Configuration#getContext()} instead of. ++ * @deprecated Use {@link Configuration#getContext()} instead. + */ + @Deprecated + public static ConfigurationContext getConfigurationContext() { + return spi().getConfigurationContext(); + } + + /** + * This method allows to replace the current {@link org.apache.tamaya.spi.ConfigurationContext} with a new + * instance. This can be used to update the context with a new one, e.g. because some of the configuration + * data has changed and should be updated. It is the responsibility of the ConfigurationProvider to trigger + * corresponding update events for the current {@link org.apache.tamaya.Configuration}, so observing + * listeners can do whatever is appropriate to react to any given configuration changes. + * + * @param context the new ConfigurationContext to be applied. + * @throws java.lang.UnsupportedOperationException if the current provider is read-only and does not support + * applying a new ConfigurationContext. + * @deprecated Use #setConfiguration(Configuration) instead of. + */ + @Deprecated + public static void setConfigurationContext(ConfigurationContext context) { + spi().setConfigurationContext(context); + } + + /** + * This method allows to replace the current default {@link org.apache.tamaya.Configuration} with a new + * instance. It is the responsibility of the ConfigurationProvider to trigger + * corresponding update events for the current {@link org.apache.tamaya.Configuration}, so observing + * listeners can do whatever is appropriate to react to any given configuration change. + * + * @param config the new Configuration to be applied, not {@code null} + * @throws java.lang.UnsupportedOperationException if the current provider is read-only and + * does not support + * applying a new Configuration. + */ + public static void setConfiguration(Configuration config) { + LOG.info("TAMAYA Applying new Configuration: " + config); + spi().setConfiguration(config); + } + + /** + * Create a new {@link ConfigurationBuilder} instance. This method creates + * a new builder instance that is not related to any concrete {@link org.apache.tamaya.spi.ConfigurationContext}. + * You can use {@link #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)} to change the + * current configuration context. + * + * @return a new, empty {@link ConfigurationBuilder}, never null. + * @see #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext) + * @see org.apache.tamaya.spi.ConfigurationContext + * @deprecated Will be removed. + */ + @Deprecated + public static ConfigurationContextBuilder getConfigurationContextBuilder() { + return spi().getConfigurationContextBuilder(); + } + + /** + * Create a new {@link ConfigurationBuilder} instance. This method creates + * a new builder instance that is not related to any concrete {@link org.apache.tamaya.spi.ConfigurationContext}. + * You can use {@link #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)} to change the + * current configuration context. + * + * @return a new, empty {@link ConfigurationBuilder}, never null. + * @see #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext) + * @see org.apache.tamaya.spi.ConfigurationContext + */ + public static ConfigurationBuilder getConfigurationBuilder() { + return spi().getConfigurationBuilder(); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cd37ae9c/code/old/api/src/main/java/org/apache/tamaya/Configuration.java ---------------------------------------------------------------------- diff --cc code/old/api/src/main/java/org/apache/tamaya/Configuration.java index b891d43,0000000..b00eebd mode 100644,000000..100644 --- a/code/old/api/src/main/java/org/apache/tamaya/Configuration.java +++ b/code/old/api/src/main/java/org/apache/tamaya/Configuration.java @@@ -1,179 -1,0 +1,179 @@@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tamaya; + +import org.apache.tamaya.spi.ConfigurationBuilder; +import org.apache.tamaya.spi.ConfigurationContext; + +import java.util.Map; + + +/** - * <p>A configuration models a aggregated set current properties, identified by ++ * <p>A configuration models an aggregated set of current properties, identified by + * a unique key, but adds higher level access functions to + * a {@link org.apache.tamaya.spi.PropertySource}. Hereby in most + * cases a configuration is a wrapper around a composite + * {@link org.apache.tamaya.spi.PropertySource} instance, which may combine - * multiple child config in well defined tree like structure, - * where nodes define logically the rules current priority, filtering, ++ * multiple child configurations in a well defined tree like structure, ++ * where nodes define logically the rules' current priority, filtering, + * combination and overriding. + * </p> + * <h3>Implementation Requirements</h3> + * Implementations current this interface must be + * <ul> + * <li>Thread safe</li> + * <li>Immutable</li> + * </ul> + * + * <p>It is not recommended that implementations also are serializable, since the any configuration can be <i>frozen</i> + * by reading out its complete configuration map into a serializable and remotable structure. This helps significantly - * simplifying the development current this interface, e.g. for being backed up by systems and stores that are not part current ++ * simplifying the development of this interface, e.g. for being backed up by systems and stores that are not part + * this library at all.</p> + */ +public interface Configuration { + + /** + * Access a property. + * + * @param key the property's key, not {@code null}. + * @return the property's value. + */ + default String get(String key){ + return get(key, TypeLiteral.of(String.class)); + } + + /** + * Access a property. + * + * @param key the property's key, not {@code null}. + * @param defaultValue value to be returned, if no value is present, not {@code null} + * @return the property's keys. + */ + default String getOrDefault(String key, String defaultValue){ + return getOrDefault(key, TypeLiteral.of(String.class), defaultValue); + } + + /** - * Get the property keys as type T. This will implicitly require a corresponding {@link - * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T - * fromMap the given String keys. ++ * Gets the property keys as type T. This will implicitly require a corresponding {@link ++ * org.apache.tamaya.spi.PropertyConverter} to be available that is capable of providing type T ++ * fromMap for the given String keys. + * + * @param <T> the type of the class modeled by the type parameter - * @param key the property's absolute, or relative path, e.g. @code ++ * @param key the property's absolute, or relative path, e.g. {@code + * a/b/c/d.myProperty}, not {@code null}. + * @param type The target type required, not {@code null}. + * @param defaultValue value to be used, if no value is present, not {@code null} + * @return the property value, never {@code null}. + * @throws ConfigException if the keys could not be converted to the required target type. + */ + default <T> T getOrDefault(String key, Class<T> type, T defaultValue){ + return getOrDefault(key, TypeLiteral.of(type), defaultValue); + } + + /** - * Get the property keys as type T. This will implicitly require a corresponding {@link - * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T - * fromMap the given String keys. ++ * Gets the property keys as type T. This will implicitly require a corresponding {@link ++ * org.apache.tamaya.spi.PropertyConverter} to be available that is capable of providing type T ++ * fromMap for the given String keys. + * + * @param <T> the type of the class modeled by the type parameter + * @param key the property's absolute, or relative path, e.g. @code + * a/b/c/d.myProperty}. + * @param type The target type required, not {@code null}. + * @return the property value, never {@code null}. + * @throws ConfigException if the keys could not be converted to the required target type. + */ + default <T> T get(String key, Class<T> type){ + return get(key, TypeLiteral.of(type)); + } + + /** + * Get the property keys as type T. This will implicitly require a corresponding {@link - * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T - * fromMap the given String keys. ++ * org.apache.tamaya.spi.PropertyConverter} to be available that is capable of providing type T ++ * literals for the given key. + * + * @param <T> the type of the type literal + * @param key the property's absolute, or relative path, e.g. @code + * a/b/c/d.myProperty}, not {@code null}. + * @param type The target type required, not {@code null}. + * @return the property value, never {@code null}. + * @throws ConfigException if the keys could not be converted to the required target type. + */ + <T> T get(String key, TypeLiteral<T> type); + + /** + * Get the property keys as type T. This will implicitly require a corresponding {@link - * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T - * fromMap the given String keys. ++ * org.apache.tamaya.spi.PropertyConverter} to be available that is capable of providing type T ++ * literals for the given key. + * + * @param <T> the type of the type literal + * @param key the property's absolute, or relative path, e.g. + * {@code a/b/c/d.myProperty}, not {@code null}. + * @param type The target type required, not {@code null}. + * @param defaultValue default value to be used, if no value is present. + * @return the property value, never null. + * @throws ConfigException if the keys could not be converted to the required target type. + */ + <T> T getOrDefault(String key, TypeLiteral<T> type, T defaultValue); + + /** + * Access all currently known configuration properties as a full {@code Map<String,String>}. + * Be aware that entries from non scannable parts of the registered {@link org.apache.tamaya.spi.PropertySource} - * instances may not be contained in the result, but nevertheless be accessible calling one of the ++ * instances may not be contained in the result, but nevertheless be accessible by calling one of the + * {@code get(...)} methods. + * @return all currently known configuration properties. + */ + Map<String,String> getProperties(); + + /** + * Extension point for adjusting configuration. + * + * @param operator A configuration operator, e.g. a filter, or an adjuster + * combining configurations, never {@code null}. + * @return the new adjusted configuration returned by the {@code operator}, never {@code null}. + */ + default Configuration with(ConfigOperator operator){ + return operator.operate(this); + } + + /** + * Query a configuration. + * + * @param <T> the type of the configuration. + * @param query the query, not {@code null}. + * @return the result returned by the {@code query}. + */ + default <T> T query(ConfigQuery<T> query){ + return query.query(this); + } + + /** + * Access a configuration's context. + * @return the configuration context, never null. + */ + ConfigurationContext getContext(); + + /** + * Create a new builder using this instance as it's base. + * @return a new builder, never null. + */ + default ConfigurationBuilder toBuilder() { + return ConfigurationProvider.getConfigurationBuilder().setConfiguration(this); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cd37ae9c/code/old/api/src/main/java/org/apache/tamaya/spi/ConfigurationBuilder.java ---------------------------------------------------------------------- diff --cc code/old/api/src/main/java/org/apache/tamaya/spi/ConfigurationBuilder.java index a2b3257,0000000..3511abe mode 100644,000000..100644 --- a/code/old/api/src/main/java/org/apache/tamaya/spi/ConfigurationBuilder.java +++ b/code/old/api/src/main/java/org/apache/tamaya/spi/ConfigurationBuilder.java @@@ -1,348 -1,0 +1,347 @@@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tamaya.spi; + +import org.apache.tamaya.Configuration; +import org.apache.tamaya.TypeLiteral; + +import java.util.Collection; +import java.util.Comparator; +import java.util.List; +import java.util.Map; + +/** - * A builder for creating new instance of {@link Configuration}. ++ * A builder for creating new instances of {@link Configuration}. + * Builders can be obtained in exactly two ways: + * <ol> + * <li>By accessing a preinitialized builder from an existing {@link Configuration}, + * by calling {@link org.apache.tamaya.spi.Configuration#toBuilder()}.</li> + * <li>By accessing an empty builder instance from + * {@link org.apache.tamaya.ConfigurationProvider#getConfigurationBuilder()}.</li> + * </ol> + * After all changes are applied to a builder a new {@link Configuration} instance can + * be created and can be applied by calling + * {@link #build()}}. + * + */ +public interface ConfigurationBuilder { + + /** + * Init this builder instance with the given {@link Configuration} instance. This + * method will use any existing property sources, filters, converters and the combination + * policy of the given {@link Configuration} and initialize the current builder + * with them. All previous property sources, filters, converters and the combination + * policy of this instance will be replaced. + * + * @param config the {@link Configuration} instance to be used, not {@code null}. + * @return this builder, for chaining, never null. + */ + ConfigurationBuilder setConfiguration(Configuration config); + + /** + * Init this builder instance with the given {@link ConfigurationContext} instance. This + * method will use any existing property sources, filters, converters and the combination + * policy of the given {@link ConfigurationContext} and initialize the current builder + * with them. All previous property sources, filters, converters and the combination + * policy of this instance will be replaced. + * + * @param context the {@link ConfigurationContext} instance to be used, not {@code null}. + * @return this builder, for chaining, never null. + */ + ConfigurationBuilder setContext(ConfigurationContext context); + + /** + * This method can be used for adding {@link PropertySource}s. + * 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 {@link #sortPropertySources}. + * + * @param propertySources the PropertySources to add + * @return this builder, for chaining, never null. + * @throws IllegalArgumentException If a property source with a given name already + * exists. + */ + ConfigurationBuilder addPropertySources(PropertySource... propertySources); + + /** + * This method can be used for programmatically adding {@link PropertySource}s. + * 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 {@link #sortPropertySources}. + * + * @param propertySources the PropertySources to add + * @return this builder, for chaining, never null. + * @throws IllegalArgumentException If a property source with a given name already + * exists. + */ + ConfigurationBuilder addPropertySources(Collection<PropertySource> propertySources); + + /** - * Add all registered (default) property sources to the context built. The sources are ordered ++ * Adds all registered (default) property sources to the context built. The sources are ordered + * based on their ordinal values and added to the chain of property sources with + * higher priority. + * @return this builder, for chaining, never null. + */ + ConfigurationBuilder addDefaultPropertySources(); + + /** + * Removes the given property sources, if existing. The existing order of property + * sources is preserved. + * + * @param propertySources the property sources to remove, not {@code null}. + * @return the builder for chaining. + */ + ConfigurationBuilder removePropertySources(PropertySource... propertySources); + + /** + * Removes the given property sources, if existing. The existing order of property + * sources is preserved. + * + * @param propertySources the property sources to remove, not {@code null}. + * @return the builder for chaining. + */ + ConfigurationBuilder removePropertySources(Collection<PropertySource> propertySources); + + /** + * Access the current chain of property sources. Items at the end of the list have - * precedence/more significance. ++ * precedence/higher significance. + * + * @return the property source chain, never {@code null}. + */ + List<PropertySource> getPropertySources(); + + /** + * Access the current chain of property filters. Items at the end of the list have - * precedence/more significance. ++ * precedence/higher significance. + * + * @return the property filter chain, never {@code null}. + */ + List<PropertyFilter> getPropertyFilters(); + + /** + * Access the current registered property converters. + * + * @return the current registered property converters. + */ + Map<TypeLiteral<?>, Collection<PropertyConverter<?>>> getPropertyConverter(); + + /** + * Increases the priority of the given property source, by moving it towards the end + * of the chain of property sources. If the property source given is already at the end + * this method has no effect. This operation does not change any ordinal values. + * + * @param propertySource the property source to be incresed regarding its significance. + * @return the builder for chaining. + * @throws IllegalArgumentException If no such property source exists in the current + * chain. + */ + ConfigurationBuilder increasePriority(PropertySource propertySource); + + /** + * Decreases the priority of the given property source, by moving it towards the start + * of the chain of property sources. If the property source given is already the first + * this method has no effect. This operation does not change any ordinal values. + * + * @param propertySource the property source to be decresed regarding its significance. + * @return the builder for chaining. + * @throws IllegalArgumentException If no such property source exists in the current + * chain. + */ + ConfigurationBuilder decreasePriority(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. If the property source given is + * already the last item this method has no effect. This operation does not change + * any ordinal values. + * + * @param propertySource the property source to be maximized regarding its significance. + * @return the builder for chaining. + * @throws IllegalArgumentException If no such property source exists in the current + * chain. + */ + ConfigurationBuilder highestPriority(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. If the property source given is + * already the first item this method has no effect. This operation does not change + * any ordinal values. + * + * @param propertySource the property source to be minimized regarding its significance. + * @return the builder for chaining. + * @throws IllegalArgumentException If no such property source exists in the current + * chain. + */ + ConfigurationBuilder lowestPriority(PropertySource propertySource); + + /** + * Adds the given PropertyFilter instances, hereby the instances are added + * to the end of the list with highest priority. The ordering of existing + * property filters remains unchanged. To sort the property + * filters call {@link #sortPropertyFilter}. + * + * @param filters the filters to add + * @return this builder, for chaining, never null. + */ + ConfigurationBuilder addPropertyFilters(PropertyFilter... filters); + + /** + * Adds the given PropertyFilter instances, hereby the instances are added + * to the end of the list with highest priority. The ordering of existing + * property filters remains unchanged. To sort the property + * filters call {@link #sortPropertyFilter}. + * + * @param filters the filters to add + * @return this builder, for chaining, never null. + */ + ConfigurationBuilder addPropertyFilters(Collection<PropertyFilter> filters); + + /** + * Add all auto-discoverable property filters to the context built. + * @return this builder, for chaining, never null. + */ + ConfigurationBuilder addDefaultPropertyFilters(); + - + /** + * Removes the given PropertyFilter instances, if existing. The order of the remaining + * filters is preserved. + * + * @param filters the filter to remove + * @return this builder, for chaining, never null. + */ + ConfigurationBuilder removePropertyFilters(PropertyFilter... filters); + + /** + * Removes the given PropertyFilter instances, if existing. The order of the remaining + * filters is preserved. + * + * @param filters the filter to remove + * @return this builder, for chaining, never null. + */ + ConfigurationBuilder removePropertyFilters(Collection<PropertyFilter> filters); + + /** + * This method can be used for adding {@link PropertyConverter}s. + * Converters are added at the end after any existing converters. + * For converters already registered for the current target type the + * method has no effect. + * + * @param typeToConvert the type for which the converter is for + * @param propertyConverters the PropertyConverters to add for this type + * @param <T> the target type. + * @return this builder, for chaining, never null. + */ + <T> ConfigurationBuilder addPropertyConverters(TypeLiteral<T> typeToConvert, + @SuppressWarnings("unchecked") PropertyConverter<T>... propertyConverters); + + /** + * This method can be used for adding {@link PropertyConverter}s. + * Converters are added at the end after any existing converters. + * For converters already registered for the current target type the + * method has no effect. + * + * @param typeToConvert the type for which the converter is for + * @param propertyConverters the PropertyConverters to add for this type + * @param <T> the target type. + * @return this builder, for chaining, never null. + */ + <T> ConfigurationBuilder addPropertyConverters(TypeLiteral<T> typeToConvert, + Collection<PropertyConverter<T>> propertyConverters); + + /** + * Add all auto-discoverable property converters to the context built. + * @return this builder, for chaining, never null. + */ + ConfigurationBuilder addDefaultPropertyConverters(); + + /** + * Removes the given PropertyConverter instances for the given type, + * if existing. + * + * @param typeToConvert the type which the converter is for + * @param propertyConverters the converter to remove + * @param <T> the target type. + * @return this builder, for chaining, never null. + */ + <T> ConfigurationBuilder removePropertyConverters(TypeLiteral<T> typeToConvert, + @SuppressWarnings("unchecked") PropertyConverter<T>... propertyConverters); + + /** + * Removes the given PropertyConverter instances for the given type, + * if existing. + * + * @param typeToConvert the type which the converter is for + * @param propertyConverters the converter to remove + * @param <T> the target type. + * @return this builder, for chaining, never null. + */ + <T> ConfigurationBuilder removePropertyConverters(TypeLiteral<T> typeToConvert, + Collection<PropertyConverter<T>> propertyConverters); + + /** + * Removes all converters for the given type, which actually renders a given type + * unsupported for type conversion. + * + * @param typeToConvert the type which the converter is for + * @return this builder, for chaining, never null. + */ + ConfigurationBuilder removePropertyConverters(TypeLiteral<?> typeToConvert); + + /** + * Sorts the current registered property sources using the given comparator. + * + * NOTE: property sources at the beginning have minimal significance. + * + * @param comparator the comparator to be used, not {@code null}. + * @return this instance for chaining. + */ + ConfigurationBuilder sortPropertySources(Comparator<PropertySource> comparator); + + /** + * Sorts the current registered property filters using the given comparator. + * + * NOTE: property filters at the beginning have minimal significance. + * + * @param comparator the comparator to be used, not {@code null}. + * @return this instance for chaining. + */ + ConfigurationBuilder sortPropertyFilter(Comparator<PropertyFilter> comparator); + + /** + * Sets the {@link PropertyValueCombinationPolicy} used to evaluate the final + * property values. + * + * @param policy the {@link PropertyValueCombinationPolicy} used, not {@code null}. + * @return this builder, for chaining, never null. + */ + ConfigurationBuilder setPropertyValueCombinationPolicy(PropertyValueCombinationPolicy policy); + + /** + * Builds a new {@link 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 {@link #sortPropertyFilter(Comparator)} and/or {@link #sortPropertySources(Comparator)} + * before building the context. + * + * @return the final configuration, never null. + */ + Configuration build(); + +} + http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cd37ae9c/pom.xml ----------------------------------------------------------------------
