bpiwowar.argparser.handlers
Class Handler

java.lang.Object
  extended by bpiwowar.argparser.handlers.Handler
Direct Known Subclasses:
GenericHandler, HelpHandler, Holder, MethodCallHandler

public abstract class Handler
extends Object

Author:
bpiwowar

Constructor Summary
Handler()
           
 
Method Summary
 void add(ValueChecker newChecker)
          Add a value checker
 Limit getLimitChecker(Limit.Type type, StringScanner scanner)
           
 Limit getLimitChecker(StringScanner scanner)
          Gets a new limit checker
 OrChecker getRangeChecker(String rangeDesc)
          Get a range checker
 boolean isHelpOption()
          Is this a help option?
abstract  int parse(ArgParser argParser, String[] args, int idx)
          Parse the arguments from the current index
 void processAnnotations()
          Process the annotations
 void setPrefix(String prefix)
          Called by ArgParser when the argument had a prefix (to handle the case of prefix chains)
 void updateRangeChecker(OrChecker orChecker, String s)
          Scan a range specification, and add the interval checks to the value handler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Handler

public Handler()
Method Detail

getLimitChecker

public Limit getLimitChecker(StringScanner scanner)
                      throws IllegalArgumentException,
                             StringScanException
Gets a new limit checker

Returns:
a new limit checker
Throws:
StringScanException
ArgParseException
IllegalArgumentException

getLimitChecker

public final Limit getLimitChecker(Limit.Type type,
                                   StringScanner scanner)
                            throws IllegalArgumentException,
                                   StringScanException
Throws:
IllegalArgumentException
StringScanException

isHelpOption

public boolean isHelpOption()
Is this a help option?

Returns:
true if the option is help option

add

public void add(ValueChecker newChecker)
Add a value checker

Parameters:
index - The index of the checker
newChecker - the checker to add (or to replace)

updateRangeChecker

public void updateRangeChecker(OrChecker orChecker,
                               String s)
                        throws IllegalArgumentException,
                               StringScanException
Scan a range specification, and add the interval checks to the value handler

Parameters:
rec - the record
s - The string to parse
Throws:
IllegalArgumentException
StringScanException
ArgParseException

getRangeChecker

public OrChecker getRangeChecker(String rangeDesc)
                          throws IllegalArgumentException,
                                 StringScanException
Get a range checker

Parameters:
rangeDesc -
Returns:
Throws:
IllegalArgumentException
StringScanException

parse

public abstract int parse(ArgParser argParser,
                          String[] args,
                          int idx)
                   throws ArgParserException
Parse the arguments from the current index

Parameters:
argParser - the argument parser
args - The set of arguments
idx - The index of the next argument at process
Throws:
ArgParseException
StringScanException
IllegalArgumentValue - If the parameter is not OK
ArgParserException

setPrefix

public void setPrefix(String prefix)
Called by ArgParser when the argument had a prefix (to handle the case of prefix chains)

Parameters:
prefix - The prefix

processAnnotations

public void processAnnotations()
Process the annotations



Copyright © 2013. All Rights Reserved.