Source code
Description: source: package: org.apache.commons.configuration2.builder, interface: FileBasedBuilderProperties

    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 java.io.File;
    020import java.net.URL;
    021
    022import org.apache.commons.configuration2.io.FileLocationStrategy;
    023import org.apache.commons.configuration2.io.FileSystem;
    024import org.apache.commons.configuration2.io.URLConnectionOptions;
    025
    026/**
    027 * <p>
    028 * Definition of a properties interface for parameters of file-based configurations.
    029 * </p>
    030 * <p>
    031 * This interface defines a set of properties which can be used to specify the location of a configuration source.
    032 * </p>
    033 *
    034 * @param <T> the type of the result of all set methods for method chaining
    035 */
    036public interface FileBasedBuilderProperties<T> {
    037
    038    /**
    039     * Sets the base path of the associated {@code FileHandler}.
    040     *
    041     * @param path the base path
    042     * @return a reference to this object for method chaining
    043     */
    044    T setBasePath(String path);
    045
    046    /**
    047     * Sets the encoding of the associated {@code FileHandler}.
    048     *
    049     * @param enc the encoding
    050     * @return a reference to this object for method chaining
    051     */
    052    T setEncoding(String enc);
    053
    054    /**
    055     * Sets the location of the associated {@code FileHandler} as a {@code File} object.
    056     *
    057     * @param file the {@code File} location
    058     * @return a reference to this object for method chaining
    059     */
    060    T setFile(File file);
    061
    062    /**
    063     * Sets the file name of the associated {@code FileHandler}.
    064     *
    065     * @param name the file name
    066     * @return a reference to this object for method chaining
    067     */
    068    T setFileName(String name);
    069
    070    /**
    071     * Sets the {@code FileSystem} of the associated {@code FileHandler}.
    072     *
    073     * @param fs the {@code FileSystem}
    074     * @return a reference to this object for method chaining
    075     */
    076    T setFileSystem(FileSystem fs);
    077
    078    /**
    079     * Sets the {@code FileLocationStrategy} for resolving the referenced file.
    080     *
    081     * @param strategy the {@code FileLocationStrategy}
    082     * @return a reference to this object for method chaining
    083     */
    084    T setLocationStrategy(FileLocationStrategy strategy);
    085
    086    /**
    087     * Sets the location of the associated {@code FileHandler} as an absolute file path.
    088     *
    089     * @param path the path location
    090     * @return a reference to this object for method chaining
    091     */
    092    T setPath(String path);
    093
    094    /**
    095     * Sets the factory for creating {@code ReloadingDetector} objects. With this method a custom factory for reloading
    096     * detectors can be installed. Per default, a factory creating {@code FileHandlerReloadingDetector} objects is used.
    097     *
    098     * @param factory the {@code ReloadingDetectorFactory}
    099     * @return a reference to this object for method chaining
    100     */
    101    T setReloadingDetectorFactory(ReloadingDetectorFactory factory);
    102
    103    /**
    104     * Sets the refresh delay for reloading support
    105     *
    106     * @param reloadingRefreshDelay the refresh delay (in milliseconds)
    107     * @return a reference to this object for method chaining
    108     */
    109    T setReloadingRefreshDelay(Long reloadingRefreshDelay);
    110
    111    /**
    112     * Sets the location of the associated {@code FileHandler} as a {@code URL} object.
    113     *
    114     * @param url the {@code URL} location
    115     * @return a reference to this object for method chaining
    116     */
    117    T setURL(URL url);
    118
    119    /**
    120     * Sets the location of the associated {@code FileHandler} as a {@code URL} object.
    121     *
    122     * @param url the {@code URL} location
    123     * @param urlConnectionOptions options
    124     * @return a reference to this object for method chaining
    125     * @since 2.8.0
    126     */
    127    default T setURL(final URL url, final URLConnectionOptions urlConnectionOptions) {
    128        return setURL(url);
    129    }
    130}