public class PathArgumentType extends Object implements ArgumentType<Path>
ArgumentType subclass for Path type, using fluent style API.
This object can convert path string to Path object. The
command-line programs traditionally accept the file path "-" as standard
input. This object supports this when
acceptSystemIn() is used. Also there are several
convenient verification features such as checking readability or existence.
| Constructor and Description |
|---|
PathArgumentType()
Create an instance using the default file system for resolving the path.
|
PathArgumentType(FileSystem fileSystem)
Create an instance using the given file system for resolving the path.
|
| Modifier and Type | Method and Description |
|---|---|
PathArgumentType |
acceptSystemIn()
If the argument is "-", accept it as standard input.
|
Path |
convert(ArgumentParser parser,
Argument arg,
String value) |
PathArgumentType |
or()
Start a new verification group.
|
PathArgumentType |
verifyCanCreate()
Verifies that the specified path is writable.
|
PathArgumentType |
verifyCanExecute()
Verifies that the specified path is executable.
|
PathArgumentType |
verifyCanRead()
Verifies that the specified path is readable.
|
PathArgumentType |
verifyCanWrite()
Verifies that the specified path is writable.
|
PathArgumentType |
verifyCanWriteParent()
Verifies that the parent directory of the specified path is writable.
|
PathArgumentType |
verifyExists()
Verifies that the specified path exists.
|
PathArgumentType |
verifyIsAbsolute()
Verifies that the specified path is an absolute path.
|
PathArgumentType |
verifyIsDirectory()
Verifies that the specified path is a directory.
|
PathArgumentType |
verifyIsFile()
Verifies that the specified path is a regular file.
|
PathArgumentType |
verifyNotExists()
Verifies that the specified path does not exist.
|
public PathArgumentType()
public PathArgumentType(FileSystem fileSystem)
Create an instance using the given file system for resolving the path.
Warning: Using the non-default file system disables all file verifications.
fileSystem - The file system to use for resolving pathspublic PathArgumentType acceptSystemIn()
public PathArgumentType verifyExists()
public PathArgumentType verifyNotExists()
public PathArgumentType verifyIsFile()
public PathArgumentType verifyIsDirectory()
public PathArgumentType verifyCanRead()
public PathArgumentType verifyCanWrite()
public PathArgumentType verifyCanWriteParent()
public PathArgumentType verifyCanCreate()
public PathArgumentType verifyCanExecute()
public PathArgumentType verifyIsAbsolute()
public PathArgumentType or()
public Path convert(ArgumentParser parser, Argument arg, String value) throws ArgumentParserException
convert in interface ArgumentType<Path>ArgumentParserExceptionCopyright © 2012–2017. All rights reserved.