TUM CCSM Commons

edu.tum.cs.commons.options
Class OptionRegistry

java.lang.Object
  extended by edu.tum.cs.commons.options.OptionRegistry

public class OptionRegistry
extends java.lang.Object

This class supports collecting options from several objects whose methods have been annotated with AOption.

Version:
$Rev: 26283 $
Author:
Benjamin Hummel, $Author: juergens $
Rating:
GREEN Hash: 547CB47E6DA25E5AC375D3F72B123FD3

Constructor Summary
OptionRegistry()
          Default constructor.
OptionRegistry(java.lang.Object optionHandler)
          Construct a new option registry and register the given option handler.
 
Method Summary
 java.util.List<AOption> getAllOptions()
          Returns a list containing all supported options.
 edu.tum.cs.commons.options.OptionApplicator getLongOption(java.lang.String name)
          Returns the OptionApplicator for the given short option name or null if no such options exists.
 edu.tum.cs.commons.options.OptionApplicator getShortOption(char name)
          Returns the OptionApplicator for the given short option name or null if no such options exists.
 void registerOptionHandler(java.lang.Object optionHandler)
          Adds all options provided by the given object to this registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptionRegistry

public OptionRegistry()
Default constructor. Does nothing but we want to allow this too.


OptionRegistry

public OptionRegistry(java.lang.Object optionHandler)
Construct a new option registry and register the given option handler.

Parameters:
optionHandler - the option handler to register.
Method Detail

registerOptionHandler

public void registerOptionHandler(java.lang.Object optionHandler)
Adds all options provided by the given object to this registry. Options are public methods annotated with AOption.

Parameters:
optionHandler - The object to extract the options from.

getShortOption

public edu.tum.cs.commons.options.OptionApplicator getShortOption(char name)
Returns the OptionApplicator for the given short option name or null if no such options exists.

Parameters:
name - the name of the requested option.
Returns:
the OptionApplicator for the given short option name or null if no such options exists.

getLongOption

public edu.tum.cs.commons.options.OptionApplicator getLongOption(java.lang.String name)
Returns the OptionApplicator for the given short option name or null if no such options exists.

Parameters:
name - the name of the requested option.
Returns:
the OptionApplicator for the given short option name or null if no such options exists.

getAllOptions

public java.util.List<AOption> getAllOptions()
Returns a list containing all supported options.

Returns:
a list containing all supported options.

TUM CCSM Commons

TUM CCSM Commons - 2.7