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