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
019/**
020 * <p>
021 * Definition of an interface for setting default values for specific configuration parameter objects.
022 * </p>
023 * <p>
024 * An object implementing this interface knows how to initialize a parameters object of a specific class with default
025 * values. Such objects can be registered at the {@link org.apache.commons.configuration2.builder.fluent.Parameters
026 * Parameters} class. Whenever a specific parameters object is created all registered {@code DefaultParametersHandler}
027 * objects that can handle this parameters type are invoked, so that they get the chance to perform arbitrary
028 * initialization.
029 * </p>
030 *
031 * @since 2.0
032 * @param <T> the type of parameters supported by this handler
033 */
034public interface DefaultParametersHandler<T> {
035    /**
036     * Initializes the specified parameters object with default values. This method is called after the parameters object
037     * was created and before it is passed to the calling code. A concrete implementation can perform arbitrary
038     * initializations. Note that if there are multiple {@code DefaultParametersHandler} objects registered supporting this
039     * parameters type they are called in the order they have been registered. So handlers registered later can override
040     * initializations done by handlers registered earlier.
041     *
042     * @param parameters the parameters object to be initialized
043     */
044    void initializeDefaults(T parameters);
045}