Class FileLocator.FileLocatorBuilder
java.lang.Object
org.apache.commons.configuration2.io.FileLocator.FileLocatorBuilder
- Enclosing class:
FileLocator
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.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
The base path.private String
The encoding.private String
The file name.private FileSystem
The file system.private FileLocationStrategy
The location strategy.private URL
The URL.private URLConnectionOptions
The URL connection options. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance ofFileLocatorBuilder
and initializes the builder's properties from the passed inFileLocator
object. -
Method Summary
Modifier and TypeMethodDescriptionSpecifies the base path of the newFileLocator
.create()
Creates a new immutableFileLocatorImpl
object based on the properties set so far for this builder.Specifies the encoding of the newFileLocator
.Specifies the file name of the newFileLocator
.fileSystem
(FileSystem fs) Specifies theFileSystem
of the newFileLocator
.private void
initBuilder
(FileLocator src) Initializes the properties of this builder from the passed in locator object.locationStrategy
(FileLocationStrategy strategy) Specifies theFileLocationStrategy
to be used when the referenced file is to be located.Specifies the source URL of the newFileLocator
.urlConnectionOptions
(URLConnectionOptions urlConnectionOptions) Specifies the source URL connection options of the newFileLocator
.
-
Field Details
-
basePath
The base path. -
encoding
The encoding. -
fileName
The file name. -
fileSystem
The file system. -
locationStrategy
The location strategy. -
sourceURL
The URL. -
urlConnectionOptions
The URL connection options.
-
-
Constructor Details
-
FileLocatorBuilder
FileLocatorBuilder(FileLocator src) Creates a new instance ofFileLocatorBuilder
and initializes the builder's properties from the passed inFileLocator
object.- Parameters:
src
- the sourceFileLocator
(may be null)
-
-
Method Details
-
basePath
Specifies the base path of the newFileLocator
.- Parameters:
path
- the base path- Returns:
- a reference to this builder for method chaining
-
create
Creates a new immutableFileLocatorImpl
object based on the properties set so far for this builder.- Returns:
- the newly created
FileLocator
object, never null.
-
encoding
Specifies the encoding of the newFileLocator
.- Parameters:
enc
- the encoding- Returns:
- a reference to this builder for method chaining
-
fileName
Specifies the file name of the newFileLocator
.- Parameters:
name
- the file name- Returns:
- a reference to this builder for method chaining
-
fileSystem
Specifies theFileSystem
of the newFileLocator
.- Parameters:
fs
- theFileSystem
- Returns:
- a reference to this builder for method chaining
-
initBuilder
Initializes the properties of this builder from the passed in locator object.- Parameters:
src
- the sourceFileLocator
-
locationStrategy
Specifies theFileLocationStrategy
to be used when the referenced file is to be located.- Parameters:
strategy
- theFileLocationStrategy
- Returns:
- a reference to this builder for method chaining
-
sourceURL
Specifies the source URL of the newFileLocator
.- 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 newFileLocator
.- Parameters:
urlConnectionOptions
- the source URL connection options.- Returns:
- a reference to this builder for method chaining
-