public abstract class AddOptionsFromCommandLine<T> extends Object
Modifier and Type | Field and Description |
---|---|
protected T |
associated
An associated entity which consumers accept.
|
Constructor and Description |
---|
AddOptionsFromCommandLine(CommandLineExtracter extract,
T associated) |
Modifier and Type | Method and Description |
---|---|
abstract void |
addOptionsFromCommandLine()
Maybe add options to the arguments from the command-line.
|
protected boolean |
ifOptionWithoutArgument(String optionShort,
java.util.function.Consumer<T> consumer)
Executes
consumer if an option exists without any argument. |
protected void |
ifPresentMultiple(String optionShort,
CheckedConsumer<String[],ExperimentExecutionException> consumer)
Executes
consumer if one or more options exists with a single
argument. |
protected void |
ifPresentSingle(String optionShort,
CheckedConsumer<String,ExperimentExecutionException> consumer)
Executes
consumer if maximally one option exists with a single
argument - without passing associated . |
protected void |
ifPresentSingleAssociated(String optionShort,
CheckedBiConsumer<T,String,ExperimentExecutionException> consumer)
Executes
consumer if maximally one option exists with a single
argument - passing associated . |
protected final T associated
public AddOptionsFromCommandLine(CommandLineExtracter extract, T associated)
public abstract void addOptionsFromCommandLine() throws ExperimentExecutionException
ExperimentExecutionException
protected boolean ifOptionWithoutArgument(String optionShort, java.util.function.Consumer<T> consumer)
consumer
if an option exists without any argument.optionShort
- name of the option in short form.consumer
- called with the associated element, if the option is present.protected void ifPresentSingleAssociated(String optionShort, CheckedBiConsumer<T,String,ExperimentExecutionException> consumer) throws ExperimentExecutionException
consumer
if maximally one option exists with a single
argument - passing associated
.optionShort
- name of the option in short form.consumer
- called with the associated object and the extracted single-argument, if the
option is present.ExperimentExecutionException
- if consumer
throws it.protected void ifPresentSingle(String optionShort, CheckedConsumer<String,ExperimentExecutionException> consumer) throws ExperimentExecutionException
consumer
if maximally one option exists with a single
argument - without passing associated
.optionShort
- name of the option in short form.consumer
- called with the associated object and the extracted single-argument, if the
option is present.ExperimentExecutionException
- if consumer
throws it.protected void ifPresentMultiple(String optionShort, CheckedConsumer<String[],ExperimentExecutionException> consumer) throws ExperimentExecutionException
consumer
if one or more options exists with a single
argument.optionShort
- name of the option in short form.consumer
- called with the associated object and the extracted single-argument, if the
option is present.ExperimentExecutionException
- if consumer
throws it.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.