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