Klasse Getopt

java.lang.Object
org.apache.fulcrum.yaafi.cli.Getopt

public class Getopt extends Object
Extremely simple command line parsing class.
  • Konstruktordetails

    • Getopt

      public Getopt(String[] args)
      Constructor
      Parameter:
      args - the command line parameters
    • Getopt

      public Getopt(String[] args, String prefix)
      Constructor.
      Parameter:
      args - the command line parameters
      prefix - the prefix for command line parameters
  • Methodendetails

    • contains

      public boolean contains(String option)
      Does the command-line options exist?
      Parameter:
      option - the option we are looking for
      Gibt zurück:
      is the given option contained in the command line arguments?
    • length

      public int length()
      Gibt zurück:
      the number of command line arguments
    • getStringValue

      public String getStringValue(String option)
      Returns the string value for the given option.
      Parameter:
      option - the option
      Gibt zurück:
      the associated value
    • getStringValue

      public String getStringValue(String option, String defaultValue)
      Returns the string value for the given option.
      Parameter:
      option - the option
      defaultValue - the default value if the option is not defined
      Gibt zurück:
      the associated value
    • getBooleanValue

      public boolean getBooleanValue(String option)
      Returns the boolean value for the given option.
      Parameter:
      option - the option
      Gibt zurück:
      the associated value
    • getBooleanValue

      public boolean getBooleanValue(String option, boolean defaultValue)
      Returns the boolean value for the given option.
      Parameter:
      option - the option
      defaultValue - the default value if the option is not defined
      Gibt zurück:
      the associated value