uk.ac.ncl.cs.instantsoap.commandlineprocessor.commandFormat
Class CommandFormat

java.lang.Object
  extended by uk.ac.ncl.cs.instantsoap.commandlineprocessor.commandFormat.CommandFormat

public class CommandFormat
extends Object

Formatting control for converting command-line options into strings.

Command-line switches can come in short and long forms, and may have different prefixes for these. By convention or preference, the short or long prefix may be preferred.

The choice for these paramers varies both by platform and by application.

Author:
Matthew Pocock

Constructor Summary
CommandFormat()
          Make a new instance with all properties set to null.
CommandFormat(String shortPrefix, String longPrefix, boolean mergeOptionsIfEmpty, boolean preferShortPrefix)
          Make a new instance with the properties set to the supplied values.
 
Method Summary
 boolean equals(Object o)
           
 String getLongPrefix()
          Get the long prefix string.
 String getShortPrefix()
          Get the sort prefx string.
 int hashCode()
           
 boolean isMergeOptionsIfEmpty()
          Find out if empty options should be merged.
 boolean isPreferShortPrefix()
          Find out if short prefixes are preferred over long ones.
 void setLongPrefix(String longPrefix)
          Set the long prefix string.
 void setMergeOptionsIfEmpty(boolean mergeOptionsIfEmpty)
          Specify if empty options should be merged.
 void setPreferShortPrefix(boolean preferShortPrefix)
          Specify if short prefixes should be preferred over long ones.
 void setShortPrefix(String shortPrefix)
          Set the short prefix string.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommandFormat

public CommandFormat()
Make a new instance with all properties set to null.


CommandFormat

public CommandFormat(String shortPrefix,
                     String longPrefix,
                     boolean mergeOptionsIfEmpty,
                     boolean preferShortPrefix)
Make a new instance with the properties set to the supplied values.

Parameters:
shortPrefix - the prefix for short switches (typically - or /)
longPrefix - the prefix for long switches (typically -- or /)
mergeOptionsIfEmpty - true if options with no arguments can be merged as in -t -x -f becomming -txf
preferShortPrefix - true if short options are preferred over long ones
Method Detail

getShortPrefix

public String getShortPrefix()
Get the sort prefx string.

Returns:
the short prefix

setShortPrefix

public void setShortPrefix(String shortPrefix)
Set the short prefix string.

Parameters:
shortPrefix - the new short prefix

getLongPrefix

public String getLongPrefix()
Get the long prefix string.

Returns:
the long prefix

setLongPrefix

public void setLongPrefix(String longPrefix)
Set the long prefix string.

Parameters:
longPrefix - the new long prefix

isMergeOptionsIfEmpty

public boolean isMergeOptionsIfEmpty()
Find out if empty options should be merged.

Returns:
the mergeOptionsIfEmpty flag

setMergeOptionsIfEmpty

public void setMergeOptionsIfEmpty(boolean mergeOptionsIfEmpty)
Specify if empty options should be merged.

Parameters:
mergeOptionsIfEmpty - the new value for the mergeOptionsIfEmpty flag

isPreferShortPrefix

public boolean isPreferShortPrefix()
Find out if short prefixes are preferred over long ones.

Returns:
the preferShortPrefix flag

setPreferShortPrefix

public void setPreferShortPrefix(boolean preferShortPrefix)
Specify if short prefixes should be preferred over long ones.

Parameters:
mergeOptionsIfEmpty - the new value for the mergeOptionsIfEmpty flag

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2006-2008. All Rights Reserved.