Package org.apache.commons.configuration2.io

## Class FileLocator.FileLocatorBuilder

- java.lang.Object
- - org.apache.commons.configuration2.io.FileLocator.FileLocatorBuilder

- Enclosing class:
    FileLocator

      public static final class FileLocator.FileLocatorBuilder
      extends Object

  A typical builder implementation for creating `FileLocator` objects. An instance of this class is returned by the `fileLocator()` method of {link FileLocatorUtils}. It can be used to define the various components of the `FileLocator` object. By calling `create()` the new immutable `FileLocator` instance is created.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `FileLocator.FileLocatorBuilder` | `basePath​(String path)` | Specifies the base path of the new `FileLocator`.
    `FileLocator` | `create()` | Creates a new immutable `FileLocatorImpl` object based on the properties set so far for this builder.
    `FileLocator.FileLocatorBuilder` | `encoding​(String enc)` | Specifies the encoding of the new `FileLocator`.
    `FileLocator.FileLocatorBuilder` | `fileName​(String name)` | Specifies the file name of the new `FileLocator`.
    `FileLocator.FileLocatorBuilder` | `fileSystem​(FileSystem fs)` | Specifies the `FileSystem` of the new `FileLocator`.
    `FileLocator.FileLocatorBuilder` | `locationStrategy​(FileLocationStrategy strategy)` | Specifies the `FileLocationStrategy` to be used when the referenced file is to be located.
    `FileLocator.FileLocatorBuilder` | `sourceURL​(URL url)` | Specifies the source URL of the new `FileLocator`.
    `FileLocator.FileLocatorBuilder` | `urlConnectionOptions​(URLConnectionOptions urlConnectionOptions)` | Specifies the source URL connection options of the new `FileLocator`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### basePath

          public FileLocator.FileLocatorBuilder basePath​(String path)

      Specifies the base path of the new `FileLocator`.
      Parameters:
        `path` - the base path
      Returns:
        a reference to this builder for method chaining

    - #### create

          public FileLocator create()

      Creates a new immutable `FileLocatorImpl` object based on the properties set so far for this builder.
      Returns:
        the newly created `FileLocator` object, never null.

    - #### encoding

          public FileLocator.FileLocatorBuilder encoding​(String enc)

      Specifies the encoding of the new `FileLocator`.
      Parameters:
        `enc` - the encoding
      Returns:
        a reference to this builder for method chaining

    - #### fileName

          public FileLocator.FileLocatorBuilder fileName​(String name)

      Specifies the file name of the new `FileLocator`.
      Parameters:
        `name` - the file name
      Returns:
        a reference to this builder for method chaining

    - #### fileSystem

          public FileLocator.FileLocatorBuilder fileSystem​(FileSystem fs)

      Specifies the `FileSystem` of the new `FileLocator`.
      Parameters:
        `fs` - the `FileSystem`
      Returns:
        a reference to this builder for method chaining

    - #### locationStrategy

          public FileLocator.FileLocatorBuilder locationStrategy​(FileLocationStrategy strategy)

      Specifies the `FileLocationStrategy` to be used when the referenced file is to be located.
      Parameters:
        `strategy` - the `FileLocationStrategy`
      Returns:
        a reference to this builder for method chaining

    - #### sourceURL

          public FileLocator.FileLocatorBuilder sourceURL​(URL url)

      Specifies the source URL of the new `FileLocator`.
      Parameters:
        `url` - the source URL
      Returns:
        a reference to this builder for method chaining

    - #### urlConnectionOptions

          public FileLocator.FileLocatorBuilder urlConnectionOptions​(URLConnectionOptions urlConnectionOptions)

      Specifies the source URL connection options of the new `FileLocator`.
      Parameters:
        `urlConnectionOptions` - the source URL connection options.
      Returns:
        a reference to this builder for method chaining