Class NamedArguments

All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class NamedArguments extends TypedProperties
Author:
Laurent Cohen
See Also:
  • Constructor Details

    • NamedArguments

      public NamedArguments()
  • Method Details

    • addSwitch

      public NamedArguments addSwitch(String name, String usage)
    • printUsage

      public NamedArguments printUsage()
      Print usage of the arguments.
      Returns:
      this object.
    • parseArguments

      public NamedArguments parseArguments(String... clArgs) throws Exception
      Parse the specified command line arguments.
      Parameters:
      clArgs - the arguments to parse.
      Returns:
      this object.
      Throws:
      Exception - if any error occurs.
    • addArg

      public NamedArguments addArg(String name, String usage, String[] aliases)
      Add a new argument with an explicit value.
      Parameters:
      name - the name of the argument.
      usage - a string describing the argument's usage.
      aliases - an optional set of alternative names for this option.
      Returns:
      return this object.
    • addSwitch

      public NamedArguments addSwitch(String name, String usage, String[] aliases)
      Add a new argument as a boollean switch.
      Parameters:
      name - the name of the argument.
      usage - a string describing the argument's usage.
      aliases - an optional set of alternative names for this option.
      Returns:
      return this object.
    • addArg

      public NamedArguments addArg(String name, String usage)
      Add a new argument with an explicit value.
      Parameters:
      name - the name of the argument.
      usage - a string describing the argument's usage.
      Returns:
      return this object.
    • getTitle

      public String getTitle()
      Get the title diaplayed in the printUsage() method.
      Returns:
      the title as a string.
    • setTitle

      public NamedArguments setTitle(String title)
      Set the title diaplayed in the printUsage() method.
      Parameters:
      title - the title as a string.
      Returns:
      this object.
    • toString

      public String toString()
      Overrides:
      toString in class AbstractTypedProperties