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