Class Argument.ArgumentBuilder<T>

java.lang.Object
com.clumd.projects.java_common_utils.arg_parser.Argument.ArgumentBuilder<T>
Enclosing class:
Argument<T>

public static class Argument.ArgumentBuilder<T> extends Object
  • Method Details

    • defaultValue

      public Argument.ArgumentBuilder<T> defaultValue(T toValue)
      Used to set the default value, and also mark that the default value has been set. This can be used to notify a local Arg Parser that a local value exists, in case it wants to display this in help text.
      Parameters:
      toValue - The value to use as a default value for this argument.
    • uniqueId

      public Argument.ArgumentBuilder<T> uniqueId(int uniqueId)
      Used to index the options, must be unique and supplied by the user.
      Returns:
      this.
    • shortOptions

      public Argument.ArgumentBuilder<T> shortOptions(Set<Character> shortOptions)
      Used to contain all the single character alias' to indicate this option
      Returns:
      this.
    • longOptions

      public Argument.ArgumentBuilder<T> longOptions(Set<String> longOptions)
      Used to contain all the word alias' to indicate this option
      Returns:
      this.
    • hasValue

      public Argument.ArgumentBuilder<T> hasValue(boolean hasValue)
      Used to indicate if this argument can be followed by a value, defaults to false
      Returns:
      this.
    • valueIsOptional

      public Argument.ArgumentBuilder<T> valueIsOptional(boolean valueIsOptional)
      Used to indicate if the value to this argument can be optional, defaults to false. (e.g. value MUST be provided)
      Returns:
      this.
    • description

      public Argument.ArgumentBuilder<T> description(String description)
      Used to describe the purpose of this Argument and how it should be used.
      Returns:
      this.
    • validationFunction

      public Argument.ArgumentBuilder<T> validationFunction(Function<T,Boolean> validationFunction)
      This function can be provided to run a verification step that the argument's value is acceptable.
      Returns:
      this.
    • conversionFunction

      public Argument.ArgumentBuilder<T> conversionFunction(Function<String,T> conversionFunction)
      This function is used to convert an argument from the CLI string form, into the object the running process needs.
      Returns:
      this.
    • defaultValueSet

      public Argument.ArgumentBuilder<T> defaultValueSet(boolean defaultValueSet)
      Used to track if a default value has been set for this argument to be used if no CLI value is found.
      Returns:
      this.
    • argumentResult

      public Argument.ArgumentBuilder<T> argumentResult(T argumentResult)
      If this argument needs a value, then this should be the fully validated and parsed output of that value.
      Returns:
      this.
    • build

      public Argument<T> build()
    • toString

      public String toString()
      Overrides:
      toString in class Object