Constructor and Description |
---|
ToolOptions(org.apache.commons.cli.CommandLine line,
FileSystem fileSystem) |
ToolOptions(org.apache.commons.cli.CommandLine line,
ToolRunningContext context) |
Modifier and Type | Method and Description |
---|---|
Optional<Double> |
getDouble(String option)
If exists, return the option value as a double.
|
<E extends Enum<E>> |
getEnum(String option,
Class<E> clazz)
If exists, return the option value as an enum.
|
Optional<Float> |
getFloat(String option)
If exists, return the option value as a float.
|
Optional<Integer> |
getInt(String option)
If exists, return the option value as an int.
|
Optional<Path> |
getPath(String option)
If exists, return the option value as a file system
Path . |
Optional<String> |
getValue(String option)
If exists, return the option value as a string.
|
<T> Optional<T> |
getValue(String option,
Function<String,T> parser)
If exists, return the option value parsed with the provided parser.
|
Optional<List<String>> |
getValues(String option)
If exists, return the option value as a list of strings, assuming they were provided
as a comma separated list.
|
boolean |
hasOption(String option)
Return true if the option is defined.
|
public ToolOptions(org.apache.commons.cli.CommandLine line, FileSystem fileSystem)
public ToolOptions(org.apache.commons.cli.CommandLine line, ToolRunningContext context)
public Optional<String> getValue(String option)
option
- The option namepublic <T> Optional<T> getValue(String option, Function<String,T> parser)
option
- The option nameparser
- A function to transform the value from string to target type.public Optional<Integer> getInt(String option)
option
- The option namepublic Optional<Float> getFloat(String option)
option
- The option namepublic Optional<Double> getDouble(String option)
option
- The option namepublic Optional<List<String>> getValues(String option)
option
- The option namepublic <E extends Enum<E>> Optional<E> getEnum(String option, Class<E> clazz)
option
- The option nameclazz
- The enum classpublic boolean hasOption(String option)
option
- The option nametrue
if the option is defined.Copyright © 2020. All rights reserved.