args4j 2.0.12-redhat-2

org.kohsuke.args4j.spi
Class OptionHandler<T>

java.lang.Object
  extended by org.kohsuke.args4j.spi.OptionHandler<T>
Type Parameters:
T - The type of the field that this OptionHandler works with.
Direct Known Subclasses:
BooleanOptionHandler, EnumOptionHandler, FileOptionHandler, MapOptionHandler, OneArgumentOptionHandler, StopOptionHandler, StringArrayOptionHandler, StringOptionHandler, URIOptionHandler, URLOptionHandler

public abstract class OptionHandler<T>
extends Object

Code that parses operands of an option into Java.

This class can be extended by application to support additional Java datatypes in option operands.

Implementation of this class needs to be registered to args4j by using CmdLineParser.registerHandler(Class,Class)

Author:
Kohsuke Kawaguchi

Field Summary
 OptionDef option
          The annotation.
 CmdLineParser owner
          The owner to which this handler belongs to.
 Setter<? super T> setter
          Object to be used for setting value.
 
Constructor Summary
protected OptionHandler(CmdLineParser parser, OptionDef option, Setter<? super T> setter)
           
 
Method Summary
abstract  String getDefaultMetaVariable()
          Gets the default meta variable name used to print the usage screen.
 String getMetaVariable(ResourceBundle rb)
           
 String getNameAndMeta(ResourceBundle rb)
           
abstract  int parseArguments(Parameters params)
          Called if the option that this owner recognizes is found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

option

public final OptionDef option
The annotation.


setter

public final Setter<? super T> setter
Object to be used for setting value.


owner

public final CmdLineParser owner
The owner to which this handler belongs to.

Constructor Detail

OptionHandler

protected OptionHandler(CmdLineParser parser,
                        OptionDef option,
                        Setter<? super T> setter)
Method Detail

parseArguments

public abstract int parseArguments(Parameters params)
                            throws CmdLineException
Called if the option that this owner recognizes is found.

Parameters:
params - The rest of the arguments. This method can use this object to access the arguments of the option if necessary. The object is valid only during the method call.
Returns:
The number of arguments consumed. For example, return 0 if this option doesn't take any parameter.
Throws:
CmdLineException

getDefaultMetaVariable

public abstract String getDefaultMetaVariable()
Gets the default meta variable name used to print the usage screen.

Returns:
null to hide a meta variable.

getMetaVariable

public final String getMetaVariable(ResourceBundle rb)

getNameAndMeta

public final String getNameAndMeta(ResourceBundle rb)

args4j 2.0.12-redhat-2

Copyright © 2003-2012 JBoss by Red Hat. All Rights Reserved.