Package org.apache.commons.vfs2
Class FileSystemConfigBuilder
java.lang.Object
org.apache.commons.vfs2.FileSystemConfigBuilder
- Direct Known Subclasses:
DefaultFileSystemConfigBuilder
,FtpFileSystemConfigBuilder
,Http4FileSystemConfigBuilder
,Http5FileSystemConfigBuilder
,HttpFileSystemConfigBuilder
,RamFileSystemConfigBuilder
,ResourceFileSystemConfigBuilder
,SftpFileSystemConfigBuilder
,ZipFileSystemConfigBuilder
Abstracts configuring
FileSystemOptions
s.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Constructs builder with default prefix.protected
FileSystemConfigBuilder
(String component) Constructs builder with specified component name. -
Method Summary
Modifier and TypeMethodDescriptionprotected Boolean
getBoolean
(FileSystemOptions fileSystemOptions, String name) Gets a named option as a Boolean.protected boolean
getBoolean
(FileSystemOptions fileSystemOptions, String name, boolean defaultValue) Gets a named option as a Boolean.protected Boolean
getBoolean
(FileSystemOptions fileSystemOptions, String name, Boolean defaultValue) Gets a named option as a Boolean.protected Byte
getByte
(FileSystemOptions fileSystemOptions, String name) Gets a named option as a Byte.protected byte
getByte
(FileSystemOptions fileSystemOptions, String name, byte defaultValue) Gets a named option as a Byte.protected Byte
getByte
(FileSystemOptions fileSystemOptions, String name, Byte defaultValue) Gets a named option as a Byte.protected Character
getCharacter
(FileSystemOptions fileSystemOptions, String name) Gets a named option as a Character.protected char
getCharacter
(FileSystemOptions fileSystemOptions, String name, char defaultValue) Gets a named option as a Character.protected Character
getCharacter
(FileSystemOptions fileSystemOptions, String name, Character defaultValue) Gets a named option as a Character.protected abstract Class<? extends FileSystem>
Gets the target of this configuration.protected Double
getDouble
(FileSystemOptions fileSystemOptions, String name) Gets a named option as a Double.protected double
getDouble
(FileSystemOptions fileSystemOptions, String name, double defaultValue) Gets a named option as a Double.protected Double
getDouble
(FileSystemOptions fileSystemOptions, String name, Double defaultValue) Gets a named option as a Double.protected Duration
getDuration
(FileSystemOptions fileSystemOptions, String name) Gets a named option as a Duration.protected Duration
getDuration
(FileSystemOptions fileSystemOptions, String name, Duration defaultValue) Gets a named option as a Duration.protected Integer
getDurationInteger
(FileSystemOptions fileSystemOptions, String name) Gets a named option as a Duration bound to the integer range.protected Integer
getDurationInteger
(FileSystemOptions fileSystemOptions, String name, Duration defaultValue) Gets a named option as a Duration bound to the integer range.protected <E extends Enum<E>>
EgetEnum
(Class<E> enumClass, FileSystemOptions fileSystemOptions, String name) Gets a named option as a Double.protected <E extends Enum<E>>
EgetEnum
(Class<E> enumClass, FileSystemOptions fileSystemOptions, String name, E defaultValue) Gets a named option as an Enum.protected Float
getFloat
(FileSystemOptions fileSystemOptions, String name) Gets a named option as a Float.protected float
getFloat
(FileSystemOptions fileSystemOptions, String name, float defaultValue) Gets a named option as a Float.protected Float
getFloat
(FileSystemOptions fileSystemOptions, String name, Float defaultValue) Gets a named option as a Float.protected Integer
getInteger
(FileSystemOptions fileSystemOptions, String name) Gets a named option as an Integer.protected int
getInteger
(FileSystemOptions fileSystemOptions, String name, int defaultValue) Gets a named option as an Integer.protected Integer
getInteger
(FileSystemOptions fileSystemOptions, String name, Integer defaultValue) Gets a named option as an Integer.protected Long
getLong
(FileSystemOptions fileSystemOptions, String name) Gets a named option as a Long.protected long
getLong
(FileSystemOptions fileSystemOptions, String name, long defaultValue) Gets a named option as a Long.protected Long
getLong
(FileSystemOptions fileSystemOptions, String name, Long defaultValue) Gets a named option as a Long.protected <T> T
getParam
(FileSystemOptions fileSystemOptions, String name) Gets a named parameter.protected <T> T
getParamOrDefault
(FileSystemOptions fileSystemOptions, String name, T defaultValue) Gets a named parameter.getRootURI
(FileSystemOptions fileSystemOptions) Gets the root URI of the file system.protected Short
getShort
(FileSystemOptions fileSystemOptions, String name) Gets a named option as a Short.protected short
getShort
(FileSystemOptions fileSystemOptions, String name, short defaultValue) Gets a named option as a Short.protected Short
getShort
(FileSystemOptions fileSystemOptions, String name, Short defaultValue) Gets a named option as a Short.protected String
getString
(FileSystemOptions fileSystemOptions, String name) Gets a named option as a String.protected String
getString
(FileSystemOptions fileSystemOptions, String name, String defaultValue) Gets a named option as a String.protected boolean
hasObject
(FileSystemOptions fileSystemOptions, String name) Checks the named setting specified.protected boolean
hasParam
(FileSystemOptions fileSystemOptions, String name) Checks if option exists.protected void
setParam
(FileSystemOptions fileSystemOptions, String name, boolean value) Sets the named parameter.protected void
setParam
(FileSystemOptions fileSystemOptions, String name, Object value) Sets the named parameter.void
setRootURI
(FileSystemOptions fileSystemOptions, String rootURI) Sets the root URI of the file system.protected Boolean
toBooleanObject
(boolean value) Converts the given primitive boolean to a Boolean object.
-
Constructor Details
-
FileSystemConfigBuilder
protected FileSystemConfigBuilder()Constructs builder with default prefix.- Since:
- 1.0
-
FileSystemConfigBuilder
Constructs builder with specified component name.- Parameters:
component
- component name to be used in prefix- Since:
- 2.0
-
-
Method Details
-
getBoolean
Gets a named option as a Boolean.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Since:
- 2.0
- See Also:
-
getBoolean
protected boolean getBoolean(FileSystemOptions fileSystemOptions, String name, boolean defaultValue) Gets a named option as a Boolean.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
- See Also:
-
getBoolean
protected Boolean getBoolean(FileSystemOptions fileSystemOptions, String name, Boolean defaultValue) Gets a named option as a Boolean.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
- See Also:
-
getByte
Gets a named option as a Byte.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Since:
- 2.0
- See Also:
-
getByte
Gets a named option as a Byte.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
- See Also:
-
getByte
Gets a named option as a Byte.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
-
getCharacter
Gets a named option as a Character.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Since:
- 2.0
- See Also:
-
getCharacter
Gets a named option as a Character.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
- See Also:
-
getCharacter
protected Character getCharacter(FileSystemOptions fileSystemOptions, String name, Character defaultValue) Gets a named option as a Character.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
-
getConfigClass
Gets the target of this configuration.- Returns:
- the specific file system class
- Since:
- 1.0
-
getDouble
Gets a named option as a Double.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Since:
- 2.0
- See Also:
-
getDouble
Gets a named option as a Double.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
- See Also:
-
getDouble
Gets a named option as a Double.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
-
getDuration
Gets a named option as a Duration.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Since:
- 2.8.0
- See Also:
-
getDuration
protected Duration getDuration(FileSystemOptions fileSystemOptions, String name, Duration defaultValue) Gets a named option as a Duration.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.8.0
-
getDurationInteger
Gets a named option as a Duration bound to the integer range.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Since:
- 2.8.0
- See Also:
-
getDurationInteger
protected Integer getDurationInteger(FileSystemOptions fileSystemOptions, String name, Duration defaultValue) Gets a named option as a Duration bound to the integer range.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.8.0
-
getEnum
protected <E extends Enum<E>> E getEnum(Class<E> enumClass, FileSystemOptions fileSystemOptions, String name) Gets a named option as a Double.- Type Parameters:
E
- enumeration type- Parameters:
enumClass
- class of enumeration typefileSystemOptions
- file system options to query, may be null.name
- the option name *- Returns:
- the option in
opts
or system properties, otherwise null - Throws:
IllegalArgumentException
- if option value is not a known enumeration.- Since:
- 2.1
- See Also:
-
getEnum
protected <E extends Enum<E>> E getEnum(Class<E> enumClass, FileSystemOptions fileSystemOptions, String name, E defaultValue) Gets a named option as an Enum.- Type Parameters:
E
- enumeration type- Parameters:
enumClass
- class of enumeration typefileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
IllegalArgumentException
- if option value is not a known enumeration.- Since:
- 2.1
- See Also:
-
getFloat
Gets a named option as a Float.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Throws:
NumberFormatException
- if option value is not a valid float.- Since:
- 2.0
- See Also:
-
getFloat
Gets a named option as a Float.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
NumberFormatException
- if option value is not a valid float.- Since:
- 2.0
- See Also:
-
getFloat
Gets a named option as a Float.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
NumberFormatException
- if option value is not a valid float.- Since:
- 2.0
-
getInteger
Gets a named option as an Integer.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Throws:
NumberFormatException
- if option value is not a valid integer.- Since:
- 2.0
- See Also:
-
getInteger
Gets a named option as an Integer.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
NumberFormatException
- if option value is not a valid integer.- Since:
- 2.0
- See Also:
-
getInteger
protected Integer getInteger(FileSystemOptions fileSystemOptions, String name, Integer defaultValue) Gets a named option as an Integer.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
NumberFormatException
- if option value is not a valid integer.- Since:
- 2.0
-
getLong
Gets a named option as a Long.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Throws:
NumberFormatException
- if option value is not a valid long.- Since:
- 2.0
- See Also:
-
getLong
Gets a named option as a Long.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
NumberFormatException
- if option value is not a valid long.- Since:
- 2.0
- See Also:
-
getLong
Gets a named option as a Long.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
NumberFormatException
- if option value is not a valid long.- Since:
- 2.0
-
getParam
Gets a named parameter.- Type Parameters:
T
- The expected return type.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- get option with this name- Returns:
- the named option or null
- Since:
- 1.0
-
getParamOrDefault
Gets a named parameter.- Type Parameters:
T
- The expected return type.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- get option with this namedefaultValue
- The default value if absent.- Returns:
- the named option or
defaultValue
. - Since:
- 2.10.0
-
getRootURI
Gets the root URI of the file system.- Parameters:
fileSystemOptions
- file system options to query, may be null.- Returns:
- The root URI, or null.
- Since:
- 2.0
-
getShort
Gets a named option as a Short.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Throws:
NumberFormatException
- if option value is not a valid short.- Since:
- 2.0
- See Also:
-
getShort
Gets a named option as a Short.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
NumberFormatException
- if option value is not a valid short- Since:
- 2.0
- See Also:
-
getShort
Gets a named option as a Short.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
NumberFormatException
- if option value is not a valid short- Since:
- 2.0
-
getString
Gets a named option as a String.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Since:
- 2.0
- See Also:
-
getString
Gets a named option as a String.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
-
hasObject
Checks the named setting specified.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the option to check inopts
or system properties- Returns:
- true if option exists
- Since:
- 2.0
-
hasParam
Checks if option exists.- Parameters:
fileSystemOptions
- file system options to query, may be null.name
- the name to look up inopts
- Returns:
- true if opts have the named parameter
- Since:
- 1.0
-
setParam
Sets the named parameter.- Parameters:
fileSystemOptions
- the file system options to modifyname
- set option with this namevalue
- boolean value to set- Since:
- 2.1
-
setParam
Sets the named parameter.- Parameters:
fileSystemOptions
- the file system options to modifyname
- set option with this namevalue
- object value to set- Since:
- 1.0
-
setRootURI
Sets the root URI of the file system.- Parameters:
fileSystemOptions
- the file system options to modifyrootURI
- The creator name to be associated with the file.- Since:
- 2.0
-
toBooleanObject
Converts the given primitive boolean to a Boolean object.- Parameters:
value
- a primitive boolean.- Returns:
- the given primitive boolean as Boolean object.
- Since:
- 2.7.0
-