Class AbstractConfigurationLoader.Builder<T extends AbstractConfigurationLoader.Builder<T,​L>,​L extends AbstractConfigurationLoader<?>>

    • Constructor Detail

      • Builder

        protected Builder()
        Create a new builder.

        This is where any custom default options can be applied.

        Since:
        4.0.0
    • Method Detail

      • file

        public T file​(File file)
        Sets the sink and source of the resultant loader to the given file.

        The source is defined using Files.newBufferedReader(Path) with UTF-8 encoding.

        The sink is defined using AtomicFiles with UTF-8 encoding.

        Parameters:
        file - the configuration file
        Returns:
        this builder (for chaining)
        Since:
        4.0.0
      • path

        public T path​(Path path)
        Sets the sink and source of the resultant loader to the given path.

        The source is defined using Files.newBufferedReader(Path) with UTF-8 encoding.

        The sink is defined using AtomicFiles with UTF-8 encoding.

        Parameters:
        path - the path of the configuration file
        Returns:
        this builder (for chaining)
        Since:
        4.0.0
      • url

        public T url​(URL url)
        Sets the source of the resultant loader to the given URL.
        Parameters:
        url - the URL of the source
        Returns:
        this builder (for chaining)
        Since:
        4.0.0
      • source

        public T source​(@Nullable Callable<BufferedReader> source)
        Sets the source of the resultant loader.

        The "source" is used by the loader to load the configuration.

        Parameters:
        source - the source
        Returns:
        this builder (for chaining)
        Since:
        4.0.0
      • sink

        public T sink​(@Nullable Callable<BufferedWriter> sink)
        Sets the sink of the resultant loader.

        The "sink" is used by the loader to save the configuration.

        Parameters:
        sink - the sink
        Returns:
        this builder (for chaining)
        Since:
        4.0.0
      • headerMode

        public T headerMode​(HeaderMode mode)
        Sets the header mode of the resultant loader.
        Parameters:
        mode - the header mode
        Returns:
        this builder (for chaining)
        Since:
        4.0.0
      • headerMode

        public HeaderMode headerMode()
        Gets the header mode to be used by the resultant loader.
        Returns:
        the header mode
        Since:
        4.0.0
      • defaultOptions

        public T defaultOptions​(ConfigurationOptions defaultOptions)
        Sets the default configuration options to be used by the resultant loader.
        Parameters:
        defaultOptions - the options
        Returns:
        this builder (for chaining)
        Since:
        4.0.0
      • defaultOptions

        public T defaultOptions​(UnaryOperator<ConfigurationOptions> defaultOptions)
        Sets the default configuration options to be used by the resultant loader by providing a function which takes the current default options and applies any desired changes.
        Parameters:
        defaultOptions - to transform the existing default options
        Returns:
        this builder (for chaining)
        Since:
        4.0.0
      • defaultOptions

        public ConfigurationOptions defaultOptions()
        Gets the default configuration options to be used by the resultant loader.
        Returns:
        the options
        Since:
        4.0.0
      • build

        public abstract L build()
        Builds the loader.
        Returns:
        a new loader
        Since:
        4.0.0