Package software.amazon.smithy.cli
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 java.lang.Object implements SmithyBuilder<Parser>
Builds anParser.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
Modifier and Type Method Description Parser.Builderargument(Parser.Argument argument)Adds an argument.Parserbuild()Creates an immutable object that is created from the properties that have been set on the builder.Parser.Builderoption(java.lang.String longName, java.lang.String help)Adds an option argument that accepts no value.Parser.Builderoption(java.lang.String shortName, java.lang.String longName, java.lang.String help)Adds an option argument that accepts no value.Parser.Builderparameter(java.lang.String longName, java.lang.String help)Adds an argument that accepts a single value.Parser.Builderparameter(java.lang.String shortName, java.lang.String longName, java.lang.String help)Adds an argument that accepts a single value.Parser.Builderpositional(java.lang.String name, java.lang.String help)Configures the name of positional arguments that come after options and parameters.Parser.BuilderrepeatedParameter(java.lang.String longName, java.lang.String help)Adds an argument that accepts a value that can be repeated.Parser.BuilderrepeatedParameter(java.lang.String shortName, java.lang.String longName, java.lang.String help)Adds an argument that accepts a value that can be repeated.
-
-
-
Method Detail
-
build
public Parser build()
Description copied from interface:SmithyBuilderCreates an immutable object that is created from the properties that have been set on the builder.- Specified by:
buildin interfaceSmithyBuilder<Parser>- Returns:
- an instance of T
-
positional
public Parser.Builder positional(java.lang.String name, java.lang.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(java.lang.String shortName, java.lang.String longName, java.lang.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(java.lang.String longName, java.lang.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(java.lang.String shortName, java.lang.String longName, java.lang.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(java.lang.String longName, java.lang.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(java.lang.String shortName, java.lang.String longName, java.lang.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(java.lang.String longName, java.lang.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.
-
-