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 org.apache.commons.configuration2.ImmutableConfiguration; 020import org.apache.commons.configuration2.event.EventSource; 021import org.apache.commons.configuration2.ex.ConfigurationException; 022 023/** 024 * <p> 025 * Definition of an interface for objects that can create {@link ImmutableConfiguration} 026 * or {@link org.apache.commons.configuration2.Configuration Configuration} objects of a 027 * specific type. 028 * </p> 029 * <p> 030 * This interface defines an abstract way of creating a {@code ImmutableConfiguration} 031 * object. It does not assume any specific way of how this is done; this is 032 * completely in the responsibility of an implementation class. There is just a 033 * single method that returns the configuration constructed by this builder. 034 * </p> 035 * <p> 036 * Note: {@code ImmutableConfiguration} is just the base interface for all configuration 037 * objects. So that the return type of the {@code getConfiguration()} method is 038 * {@code ImmutableConfiguration} does not mean that only immutable configurations can 039 * be created. 040 * </p> 041 * 042 * @since 2.0 043 * @param <T> the concrete type of the {@code ImmutableConfiguration} class produced by 044 * this builder 045 */ 046public interface ConfigurationBuilder<T extends ImmutableConfiguration> extends EventSource 047{ 048 /** 049 * Returns the configuration provided by this builder. An implementation has 050 * to perform all necessary steps for creating and initializing a 051 * {@code ImmutableConfiguration} object. 052 * 053 * @return the configuration 054 * @throws ConfigurationException if an error occurs 055 */ 056 T getConfiguration() throws ConfigurationException; 057}