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.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 * @since 2.0 038 * @param <T> the type of the result of all set methods for method chaining 039 */ 040public interface PropertiesBuilderProperties<T> { 041 /** 042 * Sets the current include listener, may be null. 043 * 044 * @param includeListener the current include listener, may be null. 045 * @return a reference to this object for method chaining 046 * @since 2.6 047 */ 048 default T setIncludeListener(final ConfigurationConsumer<ConfigurationException> includeListener) { 049 return (T) this; 050 } 051 052 /** 053 * Sets a flag whether include files are supported by the properties configuration object. If set to <b>true</b>, files 054 * listed by an include property are loaded automatically. 055 * 056 * @param f the value of the flag 057 * @return a reference to this object for method chaining 058 */ 059 T setIncludesAllowed(boolean f); 060 061 /** 062 * Sets the {@code IOFactory} to be used by the properties configuration object. With this method a custom factory for 063 * input and output streams can be set. This allows customizing the format of properties read or written by the 064 * configuration. If no {@code IOFactory} is provided, the configuration uses a default one. 065 * 066 * @param factory the {@code IOFactory} to be used by the configuration 067 * @return a reference to this object for method chaining 068 */ 069 T setIOFactory(IOFactory factory); 070 071 /** 072 * Sets the layout object for the properties configuration object. With this method a custom layout object can be set. 073 * If no layout is provided, the configuration will use a default layout. 074 * 075 * @param layout the {@code PropertiesConfigurationLayout} object to be used by the configuration 076 * @return a reference to this object for method chaining 077 */ 078 T setLayout(PropertiesConfigurationLayout layout); 079}