Package joptsimple
Class AbstractOptionSpec<V>
java.lang.Object
joptsimple.AbstractOptionSpec<V>
- Type Parameters:
V
- represents the type of the arguments this option accepts
- All Implemented Interfaces:
OptionDescriptor
,OptionSpec<V>
- Direct Known Subclasses:
ArgumentAcceptingOptionSpec
,NoArgumentOptionSpec
,NonOptionArgumentSpec
public abstract class AbstractOptionSpec<V>
extends Object
implements OptionSpec<V>, OptionDescriptor
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractOptionSpec
(String option) AbstractOptionSpec
(List<String> options, String description) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
argumentTypeIndicatorFrom
(ValueConverter<V> converter) private void
arrangeOptions
(List<String> unarranged) protected abstract V
protected V
convertWith
(ValueConverter<V> converter, String argument) Description of this option's purpose.boolean
final AbstractOptionSpec<V>
forHelp()
(package private) abstract void
handleOption
(OptionParser parser, ArgumentList arguments, OptionSet detectedOptions, String detectedArgument) int
hashCode()
final boolean
Tells whether this option is designated as a "help" option.options()
A set of options that are mutually synonymous.boolean
Tells whether this object represents the non-option arguments of a command line.toString()
final V
Gives the argument associated with the given option in the given set of detected options.Gives any arguments associated with the given option in the given set of detected options.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface joptsimple.OptionDescriptor
acceptsArguments, argumentDescription, argumentTypeIndicator, defaultValues, isRequired, requiresArgument
-
Field Details
-
options
-
description
-
forHelp
private boolean forHelp
-
-
Constructor Details
-
AbstractOptionSpec
AbstractOptionSpec(String option) -
AbstractOptionSpec
-
-
Method Details
-
options
Description copied from interface:OptionDescriptor
A set of options that are mutually synonymous.- Specified by:
options
in interfaceOptionDescriptor
- Specified by:
options
in interfaceOptionSpec<V>
- Returns:
- the string representations of this option
-
values
Description copied from interface:OptionSpec
Gives any arguments associated with the given option in the given set of detected options.Specifying a default argument value for this option will cause this method to return that default value even if this option was not detected on the command line, or if this option can take an optional argument but did not have one on the command line.
- Specified by:
values
in interfaceOptionSpec<V>
- Parameters:
detectedOptions
- the detected options to search in- Returns:
- the arguments associated with this option; an empty list if no such arguments are present, or if this option was not detected
- See Also:
-
value
Description copied from interface:OptionSpec
Gives the argument associated with the given option in the given set of detected options.Specifying a default argument value for this option will cause this method to return that default value even if this option was not detected on the command line, or if this option can take an optional argument but did not have one on the command line.
- Specified by:
value
in interfaceOptionSpec<V>
- Parameters:
detectedOptions
- the detected options to search in- Returns:
- the argument of the this option;
null
if no argument is present, or that option was not detected - See Also:
-
description
Description copied from interface:OptionDescriptor
Description of this option's purpose.- Specified by:
description
in interfaceOptionDescriptor
- Returns:
- a description for the option
-
forHelp
-
isForHelp
public final boolean isForHelp()Description copied from interface:OptionSpec
Tells whether this option is designated as a "help" option. The presence of a "help" option on a command line means that missing "required" options will not cause parsing to fail.- Specified by:
isForHelp
in interfaceOptionSpec<V>
- Returns:
- whether this option is designated as a "help" option
-
representsNonOptions
public boolean representsNonOptions()Description copied from interface:OptionDescriptor
Tells whether this object represents the non-option arguments of a command line.- Specified by:
representsNonOptions
in interfaceOptionDescriptor
- Returns:
true
if this represents non-option arguments
-
convert
-
convertWith
-
argumentTypeIndicatorFrom
-
handleOption
abstract void handleOption(OptionParser parser, ArgumentList arguments, OptionSet detectedOptions, String detectedArgument) -
arrangeOptions
-
equals
-
hashCode
public int hashCode() -
toString
-