    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 *     https://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 * @param <T> the type of parameters supported by this handler
    032 * @since 2.0
    033 */
    034public interface DefaultParametersHandler<T> {
    035
    036    /**
    037     * Initializes the specified parameters object with default values. This method is called after the parameters object
    038     * was created and before it is passed to the calling code. A concrete implementation can perform arbitrary
    039     * initializations. Note that if there are multiple {@code DefaultParametersHandler} objects registered supporting this
    040     * parameters type they are called in the order they have been registered. So handlers registered later can override
    041     * initializations done by handlers registered earlier.
    042     *
    043     * @param parameters the parameters object to be initialized
    044     */
    045    void initializeDefaults(T parameters);
    046}