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 StringThe base path.private StringThe encoding.private StringThe file name.private FileSystemThe file system.private FileLocationStrategyThe location strategy.private URLThe URL.private URLConnectionOptionsThe URL connection options. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance ofFileLocatorBuilderand initializes the builder's properties from the passed inFileLocatorobject. -
Method Summary
Modifier and TypeMethodDescriptionSpecifies the base path of the newFileLocator.create()Creates a new immutableFileLocatorImplobject 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 theFileSystemof the newFileLocator.private voidinitBuilder(FileLocator src) Initializes the properties of this builder from the passed in locator object.locationStrategy(FileLocationStrategy strategy) Specifies theFileLocationStrategyto 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 ofFileLocatorBuilderand initializes the builder's properties from the passed inFileLocatorobject.- 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 immutableFileLocatorImplobject based on the properties set so far for this builder.- Returns:
- the newly created
FileLocatorobject, 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 theFileSystemof 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 theFileLocationStrategyto 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
-