Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rj.tools.argumentprocessor
Class ArgProcessor

    java.lang.Object
      |
      +--rj.tools.argumentprocessor.ArgProcessor

public class ArgProcessor
extends java.lang.Object

`ArgProcessor` is a generic argument processor for single character options to be passed in into a command line program. The usage is inspired by Perls option handling

Version:
  $Revision: 1.3 $
Author:
  Ralph Jocham

Constructor Summary
`ArgProcessor()`

Method Summary
`void` | `defineOptions(java.lang.String definitions)` `defineOptions` - with this method the allowed arguments are defined.
`java.lang.String` | `getArgumentOption(java.lang.String option)` `getArgumentOption` - returns the value or the option
`java.lang.String[]` | `getArguments()` `getArguments` - returns the real arguments; the command arguments
`boolean` | `hasFlagOption(java.lang.String option)` `hasFlagOption` - returns if the flag option is set
`boolean` | `hasOption(java.lang.String option)` `hasOption` - check if a certain option exists; the option can either be a flag or an option with a value
`static void` | `main(java.lang.String[] args)` `main` for command line testing purpose
`void` | `putArguments(java.lang.String options)` `putArguments` - put a string containing all options and arguments separated by a white space into the ArgumentProcessor
`void` | `putArguments(java.lang.String[] options)` `putArguments` - put an array of options and arguments into the ArgurmentProcessor.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ArgProcessor

    public ArgProcessor()

Method Detail

### main

    public static void main(java.lang.String[] args)

  `main` for command line testing purpose
  Parameters:
    `args` - a `String[]` value

### defineOptions

    public void defineOptions(java.lang.String definitions)

  `defineOptions` - with this method the allowed arguments are defined. They are passed in one String. Arguments can be a trigger or have an associated argument value. Those one with a value have are followed by a ':'A
  ie. "abc" - triggers with no value
  "ab:c" - a, c are triggers b has a value
  Parameters:
    `definitions` - a `String` value

### putArguments

    public void putArguments(java.lang.String[] options)

  `putArguments` - put an array of options and arguments into the ArgurmentProcessor. The array of options are concatenated into a long Sring -- then putArguments(String) is called
  Parameters:
    `options` - a `String[]` value

### putArguments

    public void putArguments(java.lang.String options)

  `putArguments` - put a string containing all options and arguments separated by a white space into the ArgumentProcessor
  Parameters:
    `options` - a `String` value

### hasOption

    public boolean hasOption(java.lang.String option)

  `hasOption` - check if a certain option exists; the option can either be a flag or an option with a value
  Parameters:
    `option` - a `String` value
  Returns:
    a `boolean` value

### hasFlagOption

    public boolean hasFlagOption(java.lang.String option)

  `hasFlagOption` - returns if the flag option is set
  Parameters:
    `option` - a `String` value
  Returns:
    a `boolean` value

### getArgumentOption

    public java.lang.String getArgumentOption(java.lang.String option)

  `getArgumentOption` - returns the value or the option
  Parameters:
    `option` - a `String` value
  Returns:
    a `String` value

### getArguments

    public java.lang.String[] getArguments()

  `getArguments` - returns the real arguments; the command arguments
  Returns:
    a `String[]` value

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

(c) 1999-2004 by Ralph Jocham (rjocham72@netscape.net)
JCSC is released under the terms of the GNU General Public License