joptsimple
Class AbstractOptionSpec<V>

java.lang.Object
  extended by joptsimple.AbstractOptionSpec<V>
Type Parameters:
V - represents the type of the arguments this option accepts
All Implemented Interfaces:
OptionSpec<V>
Direct Known Subclasses:
ArgumentAcceptingOptionSpec, NoArgumentOptionSpec

abstract class AbstractOptionSpec<V>
extends java.lang.Object
implements OptionSpec<V>

Version:
$Id: AbstractOptionSpec.java,v 1.13 2009/04/04 01:24:27 pholser Exp $
Author:
Paul Holser

Field Summary
private  java.lang.String description
           
private  java.util.List<java.lang.String> options
           
 
Constructor Summary
protected AbstractOptionSpec(java.util.Collection<java.lang.String> options, java.lang.String description)
           
protected AbstractOptionSpec(java.lang.String option)
           
 
Method Summary
(package private) abstract  void accept(OptionSpecVisitor visitor)
           
(package private) abstract  boolean acceptsArguments()
           
private  void arrangeOptions(java.util.Collection<java.lang.String> unarranged)
           
protected abstract  V convert(java.lang.String argument)
           
(package private)  java.lang.String description()
           
 boolean equals(java.lang.Object that)
          
(package private) abstract  void handleOption(OptionParser parser, ArgumentList arguments, OptionSet detectedOptions, java.lang.String detectedArgument)
           
 int hashCode()
          
 java.util.Collection<java.lang.String> options()
           
(package private) abstract  boolean requiresArgument()
           
 java.lang.String toString()
          
 V value(OptionSet detectedOptions)
          Gives the argument associated with the given option in the given set of detected options.
 java.util.List<V> values(OptionSet detectedOptions)
          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
 

Field Detail

options

private final java.util.List<java.lang.String> options

description

private final java.lang.String description
Constructor Detail

AbstractOptionSpec

protected AbstractOptionSpec(java.lang.String option)

AbstractOptionSpec

protected AbstractOptionSpec(java.util.Collection<java.lang.String> options,
                             java.lang.String description)
Method Detail

options

public final java.util.Collection<java.lang.String> options()
Specified by:
options in interface OptionSpec<V>
Returns:
the string representations of this option

values

public final java.util.List<V> values(OptionSet detectedOptions)
Description copied from interface: OptionSpec

Gives any arguments associated with the given option in the given set of detected options.

Specified by:
values in interface OptionSpec<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

value

public final V value(OptionSet detectedOptions)
Description copied from interface: OptionSpec

Gives the argument associated with the given option in the given set of detected options.

Specified by:
value in interface OptionSpec<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

description

java.lang.String description()

convert

protected abstract V convert(java.lang.String argument)

handleOption

abstract void handleOption(OptionParser parser,
                           ArgumentList arguments,
                           OptionSet detectedOptions,
                           java.lang.String detectedArgument)

acceptsArguments

abstract boolean acceptsArguments()

requiresArgument

abstract boolean requiresArgument()

accept

abstract void accept(OptionSpecVisitor visitor)

arrangeOptions

private void arrangeOptions(java.util.Collection<java.lang.String> unarranged)

equals

public boolean equals(java.lang.Object that)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object