ml.options
Class DefaultHelpPrinter

java.lang.Object
  extended by ml.options.DefaultHelpPrinter
All Implemented Interfaces:
HelpPrinter

public class DefaultHelpPrinter
extends java.lang.Object
implements HelpPrinter

A simple implementation of the HelpPrinter interface. This can serve as a basis for more complex formatting requirements.

The following approach is used here for the command line syntax:

Option Output Format
Component Example Remark
OptionData.Type.SIMPLE option -a  
OptionData.Type.VALUE option -log <logfile> The text logfile can be changed using OptionData.setValueText()
OptionData.Type.DETAIL option -D<detail>=<value> The text value can be changed using OptionData.setValueText(), the text detail can be changed using OptionData.setDetailText()
Option names with alternate keys (-a|--Access)  
Options.Multiplicity.ZERO_OR_ONCE [-a]  
Options.Multiplicity.ONCE_OR_MORE -v=<value1> [ -v=<value2> [...]] The text value can be changed using OptionData.setValueText()
Options.Multiplicity.ZERO_OR_MORE [-v=<value1> [ -v=<value2> [...]]] The text value can be changed using OptionData.setValueText()
Exclusive constraints { <option1> | <option2> | <option3> } <optionN> is a placeholder for the general option syntax described above which is grouped here using the curly brackets and the pipe symbol


Constructor Summary
DefaultHelpPrinter()
           
 
Method Summary
 java.lang.String getCommandLine(OptionSet set, java.lang.String leadingText, boolean lineBreak)
          Return a string with the command line syntax for the given option set
 java.lang.String getHelpText(OptionSet set)
          Return the help text describing the different options and data arguments
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultHelpPrinter

public DefaultHelpPrinter()
Method Detail

getHelpText

public java.lang.String getHelpText(OptionSet set)
Return the help text describing the different options and data arguments

Specified by:
getHelpText in interface HelpPrinter
Parameters:
set - The OptionSet to format the output for

Returns:
A string with the help text for this option set

getCommandLine

public java.lang.String getCommandLine(OptionSet set,
                                       java.lang.String leadingText,
                                       boolean lineBreak)
Return a string with the command line syntax for the given option set

Specified by:
getCommandLine in interface HelpPrinter
Parameters:
set - The OptionSet to format the output for
leadingText - The text to precede the command line
lineBreak - A boolean indicating whether the command line for the option set should be printed with line breaks after each option or not

Returns:
A string with the command line syntax for this option set