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