Class Parser.Builder

java.lang.Object
software.amazon.smithy.cli.Parser.Builder
All Implemented Interfaces:
SmithyBuilder<Parser>
Enclosing class:
Parser

public static final class Parser.Builder extends Object implements SmithyBuilder<Parser>
Builds an Parser.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • build

      public Parser build()
      Description copied from interface: SmithyBuilder
      Creates an immutable object that is created from the properties that have been set on the builder.
      Specified by:
      build in interface SmithyBuilder<Parser>
      Returns:
      an instance of T
    • positional

      public Parser.Builder positional(String name, String help)
      Configures the name of positional arguments that come after options and parameters.
      Parameters:
      name - Name of the positional argument.
      help - Positional argument help text.
      Returns:
      Returns the builder.
    • argument

      public Parser.Builder argument(Parser.Argument argument)
      Adds an argument. Arguments appear before positional arguments.
      Parameters:
      argument - Argument to add.
      Returns:
      Returns the builder.
    • option

      public Parser.Builder option(String shortName, String longName, String help)
      Adds an option argument that accepts no value.
      Parameters:
      shortName - Short name (e.g., -o).
      longName - Long name (e.g., --output).
      help - Help text for the option.
      Returns:
      Returns the builder.
    • option

      public Parser.Builder option(String longName, String help)
      Adds an option argument that accepts no value.
      Parameters:
      longName - Long name (e.g., --output).
      help - Help text for the option.
      Returns:
      Returns the builder.
    • parameter

      public Parser.Builder parameter(String shortName, String longName, String help)
      Adds an argument that accepts a single value.
      Parameters:
      shortName - Short nam (e.g., -o).
      longName - Long name (e.g., --output).
      help - Help text for the parameter.
      Returns:
      Returns the builder.
    • parameter

      public Parser.Builder parameter(String longName, String help)
      Adds an argument that accepts a single value.
      Parameters:
      longName - Long name (e.g., --output).
      help - Help text for the parameter.
      Returns:
      Returns the builder.
    • repeatedParameter

      public Parser.Builder repeatedParameter(String shortName, String longName, String help)
      Adds an argument that accepts a value that can be repeated.
      Parameters:
      shortName - Short nam (e.g., -o).
      longName - Long name (e.g., --output).
      help - Help text for the parameter.
      Returns:
      Returns the builder.
    • repeatedParameter

      public Parser.Builder repeatedParameter(String longName, String help)
      Adds an argument that accepts a value that can be repeated.
      Parameters:
      longName - Long name (e.g., --output).
      help - Help text for the parameter.
      Returns:
      Returns the builder.