Class CMDImpl<C extends IComponent<C>>

java.lang.Object
io.ciera.runtime.summit.util.Utility<C>
io.ciera.runtime.summit.util.impl.CMDImpl<C>
All Implemented Interfaces:
IActionHome<C>, CMD

public class CMDImpl<C extends IComponent<C>> extends Utility<C> implements CMD
  • Constructor Details

    • CMDImpl

      public CMDImpl(C context)
  • Method Details

    • get_flag

      public boolean get_flag(String name) throws XtumlException
      Description copied from interface: CMD
      Get the value of a registered command line flag.
      Specified by:
      get_flag in interface CMD
      Parameters:
      name - the name of the flag
      Returns:
      true if the flag was passed as a command line argument, false if otherwise
      Throws:
      XtumlException - if the command line has not been read, the flag name has not been registered, or if the flag has been registered as a value.
    • get_value

      public String get_value(String name) throws XtumlException
      Description copied from interface: CMD
      Get the value of a registered command line value.
      Specified by:
      get_value in interface CMD
      Parameters:
      name - the name of the value
      Returns:
      the value of the option passed on the command line or the registered default value if not present and not required
      Throws:
      XtumlException - if the command line has not been read, the value name has not been registered, or if the value has been registered as a flag.
    • read_command_line

      public void read_command_line() throws XtumlException
      Description copied from interface: CMD
      Parse and validate the command line arguments based on the previously registered flags and values. If an excption is thrown, the usage is printed to the command line and the application will exit.
      Specified by:
      read_command_line in interface CMD
      Throws:
      XtumlException - if the command line has already been read
    • register_flag

      public void register_flag(String name, String usage) throws XtumlException
      Description copied from interface: CMD
      Register a command line flag.
      Specified by:
      register_flag in interface CMD
      Parameters:
      name - the name of the flag
      usage - the help text to display in the usage
      Throws:
      XtumlException - if the command line has already been read, the flag name has already been registered, or if the flag name is invalid.
    • register_value

      public void register_value(String name, String value_name, String usage, String default_value, boolean required) throws XtumlException
      Description copied from interface: CMD
      Register a command line value. If the flag is required, the default_value parameter is ignored.
      Specified by:
      register_value in interface CMD
      Parameters:
      name - the name of the value
      value_name - the placeholder name of the value to display in the usage
      usage - the help text to display in the usage
      default_value - the default value of the option if not required and no value is specified
      required - whether or not a value is required
      Throws:
      XtumlException - if the command line has already been read, the option name has already been registered, or if the option name is invalid.