proper.io
Class CommandLineParameter

java.lang.Object
  extended by proper.io.CommandLineParameter

public class CommandLineParameter
extends java.lang.Object

Represents the definition of a command line parameter, includes methods for checking and outputting data. A "\n" in the description denotes a line break.

Version:
$Revision: 1.2 $
Author:
FracPete

Constructor Summary
CommandLineParameter(java.lang.String name, java.lang.String description)
          initializes the parameter as flag
CommandLineParameter(java.lang.String name, java.lang.String description, boolean hasArgument, java.lang.String argDesc, boolean optional)
          initializes the parameter
 
Method Summary
 java.lang.String getDescription()
          returns the stored description
 int getIndention()
          returns the indention for printing
 java.lang.String getName()
          returns the name of the parameter
 boolean hasArgument()
          returns whether the parameter has an argument or is just a flag
 boolean hasDescription()
          returns whether a description for the parameter exists
 boolean isOptional()
          returns whether the parameter is optional
static void main(java.lang.String[] args)
          for testing only
 void setIndention(int indention)
          sets the indention for printing
 java.lang.String toString()
          prints the parameter with description according to indention
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommandLineParameter

public CommandLineParameter(java.lang.String name,
                            java.lang.String description)
initializes the parameter as flag

Parameters:
name - the name of the parameter
description - the description of the parameter

CommandLineParameter

public CommandLineParameter(java.lang.String name,
                            java.lang.String description,
                            boolean hasArgument,
                            java.lang.String argDesc,
                            boolean optional)
initializes the parameter

Parameters:
name - the name of the parameter
description - the description of the parameter
hasArgument - whether the parameter needs an argument
argDesc - the description of the argument, "<arg>" if NULL or ""
optional - whether the parameter it optional
Method Detail

getName

public java.lang.String getName()
returns the name of the parameter


hasDescription

public boolean hasDescription()
returns whether a description for the parameter exists


getDescription

public java.lang.String getDescription()
returns the stored description


hasArgument

public boolean hasArgument()
returns whether the parameter has an argument or is just a flag


isOptional

public boolean isOptional()
returns whether the parameter is optional


setIndention

public void setIndention(int indention)
sets the indention for printing

See Also:
toString()

getIndention

public int getIndention()
returns the indention for printing

See Also:
toString()

toString

public java.lang.String toString()
prints the parameter with description according to indention

Overrides:
toString in class java.lang.Object
See Also:
setIndention(int)

main

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