Class Option<T>

java.lang.Object
org.strassburger.tui4j.command.Option<T>

public class Option<T> extends Object
  • Constructor Details

  • Method Details

    • getLongName

      public String getLongName()
    • getShortName

      public String getShortName()
    • getType

      public Class<T> getType()
    • getDefaultValue

      public T getDefaultValue()
    • of

      public static <T> Option<T> of(String longName, String shortName, Class<T> type, T defaultValue)
    • bool

      public static Option<Boolean> bool(String longName, String shortName)
      Creates a boolean option.
      Parameters:
      longName - The long name of the option (e.g., "--verbose")
      shortName - The short name of the option (e.g., "-v")
      Returns:
      An Option instance for a boolean type
    • str

      public static Option<String> str(String longName, String shortName, String defaultValue)
      Creates a string option.
      Parameters:
      longName - The long name of the option (e.g., "--output")
      shortName - The short name of the option (e.g., "-o")
      defaultValue - The default value of the option
      Returns:
      An Option instance for a string type
    • integer

      public static Option<Integer> integer(String longName, String shortName, Integer defaultValue)
      Creates an integer option.
      Parameters:
      longName - The long name of the option (e.g., "--count")
      shortName - The short name of the option (e.g., "-c")
      defaultValue - The default value of the option
      Returns:
      An Option instance for an integer type
    • dbl

      public static Option<Double> dbl(String longName, String shortName, Double defaultValue)
      Creates a double option.
      Parameters:
      longName - The long name of the option (e.g., "--threshold")
      shortName - The short name of the option (e.g., "-t")
      defaultValue - The default value of the option
      Returns:
      An Option instance for a double type
    • flt

      public static Option<Float> flt(String longName, String shortName, Float defaultValue)
      Creates a float option.
      Parameters:
      longName - The long name of the option (e.g., "--ratio")
      shortName - The short name of the option (e.g., "-r")
      defaultValue - The default value of the option
      Returns:
      An Option instance for a float type