Argument

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jagatoo.commandline
Class Argument

    java.lang.Object
      org.jagatoo.commandline.Argument

Direct Known Subclasses:
  HelpArgument

    public class Argument

extends java.lang.Object

A single argument of a command line.

Author:
  Marvin Froehlich (aka Qudus)

Constructor Summary
`Argument(char shortName, java.lang.String longName, java.lang.String description, boolean needsValue)` Creates a new argument.

Method Summary
`boolean` | `equals(java.lang.Object o)`
`java.lang.String` | `getDecription()` Gets this argument's description.
`java.lang.String` | `getLongName()` Gets the long name of this argument.
`char` | `getShortName()` Gets the short name (one char) of this argument.
`int` | `hashCode()`
`boolean` | `needsValue()` Returns whether this argument needs a value or if it is a switch.
`java.lang.Object` | `parseValue(java.lang.String rawValue)` Parses the concrete value from the input String.
`protected java.lang.Object` | `parseValueImpl(java.lang.String rawValue)` This method must be overridden for arguments, that take non-String values.
`java.lang.String` | `toString()`

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

Constructor Detail

### Argument

    public Argument(char shortName,
                    java.lang.String longName,
                    java.lang.String description,
                    boolean needsValue)

  Creates a new argument.

  Parameters:
    `shortName` - the short name. Use '\0' for no short name.
    `longName` - the long name. Use null for no long name.
    `description` - the description (can be null).
    `needsValue` -

Method Detail

### getShortName

    public final char getShortName()

  Gets the short name (one char) of this argument.

  Returns:
    the short name.

### getLongName

    public final java.lang.String getLongName()

  Gets the long name of this argument.

  Returns:
    the long name.

### getDecription

    public final java.lang.String getDecription()

  Gets this argument's description.

  Returns:
    the description.

### needsValue

    public final boolean needsValue()

  Returns whether this argument needs a value or if it is a switch.

  Returns:
    true, if the argument needs a value, false otherwise.

### parseValueImpl

    protected java.lang.Object parseValueImpl(java.lang.String rawValue)
                                       throws CommandlineParsingException

  This method must be overridden for arguments, that take non-String values.

  Parameters:
    `rawValue` - the raw String value
  Returns:
    the parsed value (by default the input String is passed back).
  Throws:
    `CommandlineParsingException`

### parseValue

    public final java.lang.Object parseValue(java.lang.String rawValue)
                                      throws CommandlineParsingException

  Parses the concrete value from the input String.

  Parameters:
    `rawValue` - the raw String value
  Returns:
    the parsed value.
  Throws:
    `CommandlineParsingException`

### equals

    public boolean equals(java.lang.Object o)

  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`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD