net.ontopia.utils
Class CmdlineOptions

java.lang.Object
  extended by net.ontopia.utils.CmdlineOptions

public class CmdlineOptions
extends java.lang.Object

INTERNAL: A class that parses command line options.


Nested Class Summary
static interface CmdlineOptions.ListenerIF
          INTERNAL: A listener interface that must be implemented by object that are interested in options found by the CmdlineOptions instance.
static class CmdlineOptions.OptionsException
          INTERNAL: An exception that is thrown when there are problems with the options specified on the command line.
 
Constructor Summary
CmdlineOptions(java.lang.String application, java.lang.String[] argv)
           
 
Method Summary
 void addLong(CmdlineOptions.ListenerIF listener, java.lang.String name, char c)
          Add a long argumentless option with the specified listener.
 void addLong(CmdlineOptions.ListenerIF listener, java.lang.String name, char c, boolean req_arg)
          Add a long option with argument with the specified listener.
 void addShort(CmdlineOptions.ListenerIF listener, char c)
          Add a short argumentless option with the specified listener.
 void addShort(CmdlineOptions.ListenerIF listener, char c, boolean req_arg)
          Add a short option with argument with the specified listener.
 java.lang.String[] getArguments()
          Return non-option arguments that are remaining after parsing the command line arguments.
 void parse()
          Parse the command line arguments and notify option listeners.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmdlineOptions

public CmdlineOptions(java.lang.String application,
                      java.lang.String[] argv)
Method Detail

addShort

public void addShort(CmdlineOptions.ListenerIF listener,
                     char c)
Add a short argumentless option with the specified listener.


addShort

public void addShort(CmdlineOptions.ListenerIF listener,
                     char c,
                     boolean req_arg)
Add a short option with argument with the specified listener.


addLong

public void addLong(CmdlineOptions.ListenerIF listener,
                    java.lang.String name,
                    char c)
Add a long argumentless option with the specified listener.


addLong

public void addLong(CmdlineOptions.ListenerIF listener,
                    java.lang.String name,
                    char c,
                    boolean req_arg)
Add a long option with argument with the specified listener.


parse

public void parse()
           throws CmdlineOptions.OptionsException
Parse the command line arguments and notify option listeners.

Throws:
CmdlineOptions.OptionsException

getArguments

public java.lang.String[] getArguments()
Return non-option arguments that are remaining after parsing the command line arguments.



Copyright © 2000-2009 Ontopia.