001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.configuration2.builder;
018
019import java.util.Map;
020
021/**
022 * <p>
023 * An interface to be implemented by objects which can be used to parameterize a
024 * {@link ConfigurationBuilder}.
025 * </p>
026 * <p>
027 * This interface is part of a Java DSL for creating and initializing builders
028 * for specific {@code Configuration} classes. Concrete implementations
029 * typically collect a set of related properties for the builder. There will be
030 * specific set methods for providing values for these properties. Then, this
031 * interface requires a generic {@code getParameters()} method which has to
032 * return all property values as a map. When constructing the builder the map is
033 * evaluated to define properties of the {@code Configuration} objects to be
034 * constructed.
035 * </p>
036 *
037 * @version $Id: BuilderParameters.java 1624601 2014-09-12 18:04:36Z oheger $
038 * @since 2.0
039 */
040public interface BuilderParameters
041{
042    /**
043     * Constant for a prefix for reserved initialization parameter keys. If a
044     * parameter was set whose key starts with this prefix, it is filtered out
045     * before the initialization of a newly created result object. This
046     * mechanism allows implementing classes to store specific configuration
047     * data in the parameters map which does not represent a property value for
048     * the result object.
049     */
050    String RESERVED_PARAMETER_PREFIX = "config-";
051
052    /**
053     * Returns a map with all parameters defined by this objects. The keys of
054     * the map correspond to concrete properties supported by the
055     * {@code Configuration} implementation class the builder produces. The
056     * values are the corresponding property values. The return value must not
057     * be <b>null</b>.
058     *
059     * @return a map with builder parameters
060     */
061    Map<String, Object> getParameters();
062}