org.apache.commons.cli2.option
Class HelpLineImpl

java.lang.Object
  extended by org.apache.commons.cli2.option.HelpLineImpl
All Implemented Interfaces:
HelpLine

public class HelpLineImpl
extends java.lang.Object
implements HelpLine

Represents a line in the help screen.


Field Summary
private  java.util.Comparator cachedComparator
          The comparator used to obtain the previous usage
private  java.util.Set cachedHelpSettings
          The help settings used to obtain the previous usage
private  java.lang.String cachedUsage
          The previously obtained usage
private  int indent
          The level of indenting for this item
private  Option option
          The option that this HelpLineImpl describes
 
Constructor Summary
HelpLineImpl(Option option, int indent)
          Creates a new HelpLineImpl to represent a particular Option in the online help.
 
Method Summary
 java.lang.String getDescription()
           
 int getIndent()
           
 Option getOption()
           
 java.lang.String usage(java.util.Set helpSettings, java.util.Comparator comparator)
          Builds a usage string for the option using the specified settings and comparator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

option

private final Option option
The option that this HelpLineImpl describes


indent

private final int indent
The level of indenting for this item


cachedHelpSettings

private transient java.util.Set cachedHelpSettings
The help settings used to obtain the previous usage


cachedComparator

private transient java.util.Comparator cachedComparator
The comparator used to obtain the previous usage


cachedUsage

private transient java.lang.String cachedUsage
The previously obtained usage

Constructor Detail

HelpLineImpl

public HelpLineImpl(Option option,
                    int indent)
Creates a new HelpLineImpl to represent a particular Option in the online help.

Parameters:
option - Option that the HelpLineImpl describes
indent - Level of indentation for this line
Method Detail

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface HelpLine
Returns:
The description of the option

getIndent

public int getIndent()
Specified by:
getIndent in interface HelpLine
Returns:
The level of indentation for this line

getOption

public Option getOption()
Specified by:
getOption in interface HelpLine
Returns:
The Option that the help line relates to

usage

public java.lang.String usage(java.util.Set helpSettings,
                              java.util.Comparator comparator)
Builds a usage string for the option using the specified settings and comparator.

Specified by:
usage in interface HelpLine
Parameters:
helpSettings - the settings to apply
comparator - a comparator to sort options when applicable
Returns:
the usage string