    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.ConfigurationConsumer;
    020import org.apache.commons.configuration2.PropertiesConfiguration.IOFactory;
    021import org.apache.commons.configuration2.PropertiesConfigurationLayout;
    022import org.apache.commons.configuration2.ex.ConfigurationException;
    023
    024/**
    025 * <p>
    026 * Definition of a parameters interface for properties configurations.
    027 * </p>
    028 * <p>
    029 * This interface defines additional properties which can be set when initializing a {@code PropertiesConfiguration}
    030 * object.
    031 * </p>
    032 * <p>
    033 * <strong>Important note:</strong> This interface is not intended to be implemented by client code! It defines a set of
    034 * available properties and may be extended even in minor releases.
    035 * </p>
    036 *
    037 * @param <T> the type of the result of all set methods for method chaining
    038 * @since 2.0
    039 */
    040public interface PropertiesBuilderProperties<T> {
    041
    042    /**
    043     * Sets the current include listener, may be null.
    044     *
    045     * @param includeListener the current include listener, may be null.
    046     * @return a reference to this object for method chaining
    047     * @since 2.6
    048     */
    049    default T setIncludeListener(final ConfigurationConsumer<ConfigurationException> includeListener) {
    050        return (T) this;
    051    }
    052
    053    /**
    054     * Sets a flag whether include files are supported by the properties configuration object. If set to <strong>true</strong>, files
    055     * listed by an include property are loaded automatically.
    056     *
    057     * @param f the value of the flag
    058     * @return a reference to this object for method chaining
    059     */
    060    T setIncludesAllowed(boolean f);
    061
    062    /**
    063     * Sets the {@code IOFactory} to be used by the properties configuration object. With this method a custom factory for
    064     * input and output streams can be set. This allows customizing the format of properties read or written by the
    065     * configuration. If no {@code IOFactory} is provided, the configuration uses a default one.
    066     *
    067     * @param factory the {@code IOFactory} to be used by the configuration
    068     * @return a reference to this object for method chaining
    069     */
    070    T setIOFactory(IOFactory factory);
    071
    072    /**
    073     * Sets the layout object for the properties configuration object. With this method a custom layout object can be set.
    074     * If no layout is provided, the configuration will use a default layout.
    075     *
    076     * @param layout the {@code PropertiesConfigurationLayout} object to be used by the configuration
    077     * @return a reference to this object for method chaining
    078     */
    079    T setLayout(PropertiesConfigurationLayout layout);
    080}