org.openmdx.base.application.control
Class CmdLineOption

java.lang.Object
  extended by org.openmdx.base.application.control.CmdLineOption

public class CmdLineOption
extends Object

The CmdLineOption describes represents a single command line option Sample 1 -d -z --port 80 --logFile ../tst.log


Constructor Summary
CmdLineOption(String id, String usage)
          Option declaration for switches.
CmdLineOption(String id, String usage, int minimum)
          Option declaration !!Restrictions!! The specification for optional arguments as the POSIX standard states is not implemented.
CmdLineOption(String id, String usage, int minimum, int maximum)
          Option declaration !!Restrictions!! The specification for optional arguments as the POSIX standard states is not implemented.
CmdLineOption(String id, String usage, int minimum, int maximum, boolean secret)
          Option declaration !!Restrictions!! The specification for optional arguments as the POSIX standard states is not implemented.
 
Method Summary
 String getId()
          Returns the id
 int getMaximum()
          Returns the maximum number of arguments for this option
 int getMinimum()
          Returns the minimal number of arguments for this option
 String getUsage()
          Returns the usage string
 boolean isSecret()
          Returns true if the arguments for this option are secret (password, ...).
 boolean isSwitch()
          Tests if the option is a switch
 String toString()
          Returns a string representation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CmdLineOption

public CmdLineOption(String id,
                     String usage)
Option declaration for switches. Switches are always optional. They may or may not be given on the command line. This is in contrast to options where a minimun and a maximum value for repetitions must be specified. !! Restrictions !! The switches -h, --help and --helphelp are reserved for help functionality and may not be specified by applications! E.g: id [-a] "a" [--noLog] "noLog"

Parameters:
id - The (long or short) switch's id.
usage - The part of the usage string associated with this specific switch.

CmdLineOption

public CmdLineOption(String id,
                     String usage,
                     int minimum,
                     int maximum)
Option declaration !!Restrictions!! The specification for optional arguments as the POSIX standard states is not implemented. Arguments are always required (option) or not required (switch). Therefore only two CmdLineOption constructors are provided. Default arguments will be supported in the near future through an additional constructor. E.g: id minimum maximum --host foo.com "host" 1 1 --port 80 --port 81 "port" 1 2 [--host foo.com] "host" 0 1 [--port 80] [--port 81] "port" 0 2

Parameters:
id - The (long or short) option's id.
usage - The part of the usage string associated with this specific option.
minimum - Defines the minimal number of repetitions for this option.
maximum - Defines the maximal number of repetitions for this option.

CmdLineOption

public CmdLineOption(String id,
                     String usage,
                     int minimum,
                     int maximum,
                     boolean secret)
Option declaration !!Restrictions!! The specification for optional arguments as the POSIX standard states is not implemented. Arguments are always required (option) or not required (switch). Therefore only two CmdLineOption constructors are provided. Default arguments will be supported in the near future through an additional constructor. E.g: id minimum maximum --host foo.com "host" 1 1 --port 80 --port 81 "port" 1 2 [--host foo.com] "host" 0 1 [--port 80] [--port 81] "port" 0 2

Parameters:
id - The (long or short) option's id.
usage - The part of the usage string associated with this specific option.
minimum - Defines the minimal number of repetitions for this option.
maximum - Defines the maximal number of repetitions for this option.
secret - The option is secret. Meaning that its argument must not be logged or made in other ways public.

CmdLineOption

public CmdLineOption(String id,
                     String usage,
                     int minimum)
Option declaration !!Restrictions!! The specification for optional arguments as the POSIX standard states is not implemented. Arguments are always required (option) or not required (switch). Therefore only two CmdLineOption constructors are provided. Default arguments will be supported in the near future through an additional constructor. E.g: id minimum --host foo.com "host" 1 --port 80 --port 81 "port" 1 [--host foo.com] "host" 0 [--port 80] [--port 81] "port" 0

Parameters:
id - The (long or short) option's id.
usage - The part of the usage string associated with this specific option.
minimum - Defines the minimal number of repetitions for this option.
Method Detail

getId

public String getId()
Returns the id

Returns:
a String

getUsage

public String getUsage()
Returns the usage string

Returns:
a String

isSwitch

public boolean isSwitch()
Tests if the option is a switch

Returns:
true if a switch

getMinimum

public int getMinimum()
Returns the minimal number of arguments for this option

Returns:
a number

getMaximum

public int getMaximum()
Returns the maximum number of arguments for this option

Returns:
a number

isSecret

public boolean isSecret()
Returns true if the arguments for this option are secret (password, ...).

Returns:
true if logging permitted

toString

public String toString()
Returns a string representation

Overrides:
toString in class Object
Returns:
a string


This software is published under the BSD license. Copyright © 2003-2008, OMEX AG, Switzerland, All rights reserved. Use is subject to license terms.