org.sadun.util
Class CmdLineOptions.ChainedHandler

java.lang.Object
  extended byorg.sadun.util.CmdLineOptions.Handler
      extended byorg.sadun.util.CmdLineOptions.ChainedHandler
All Implemented Interfaces:
java.lang.Comparable
Enclosing class:
CmdLineOptions

public static class CmdLineOptions.ChainedHandler
extends CmdLineOptions.Handler

A chained handler: executes two handlers one after the other. The two handlers must handle the same option; the description of the option is taken by the first handler.


Nested Class Summary
 
Nested classes inherited from class org.sadun.util.CmdLineOptions.Handler
CmdLineOptions.Handler.ParamSet
 
Field Summary
 
Fields inherited from class org.sadun.util.CmdLineOptions.Handler
aliases, description, option, priority
 
Constructor Summary
CmdLineOptions.ChainedHandler(CmdLineOptions.Handler h1, CmdLineOptions.Handler h2)
          Build an handlers which chains the two given ones.
 
Method Summary
 java.lang.String getDescription()
          Returns the description as provided by the first of the two chained handlers.
 void option(java.lang.String option, CmdLineOptions.Handler.ParamSet ps, boolean value)
          Executes the two chained handlers one after the other.
 void setDescription(java.lang.String description)
          Sets the description of both the chained handlers.
 
Methods inherited from class org.sadun.util.CmdLineOptions.Handler
addAliases, addAliases, compareTo, getAliases, getPriority, setAliases, setAliases, setPriority, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CmdLineOptions.ChainedHandler

public CmdLineOptions.ChainedHandler(CmdLineOptions.Handler h1,
                                     CmdLineOptions.Handler h2)
Build an handlers which chains the two given ones.

Parameters:
h1 - the handler executed first.
h2 - the handler executed second.
Method Detail

option

public final void option(java.lang.String option,
                         CmdLineOptions.Handler.ParamSet ps,
                         boolean value)
Executes the two chained handlers one after the other.

Specified by:
option in class CmdLineOptions.Handler
Parameters:
option - the option literal.
ps - a ParamSet object, to browse option parameters.
value - specifies if the option has been set or unset.

setDescription

public void setDescription(java.lang.String description)
Sets the description of both the chained handlers.

Overrides:
setDescription in class CmdLineOptions.Handler
Parameters:
description - a short description of the tool.

getDescription

public java.lang.String getDescription()
Returns the description as provided by the first of the two chained handlers.

Overrides:
getDescription in class CmdLineOptions.Handler
Returns:
the description as provided by the first of the two chained handlers.


Copyright © 1999-2004 Cristiano Sadun. This software is released under GPL.