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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Parser.Builder
argument(Parser.Argument argument)
Adds an argument.Parser
build()
Creates an immutable object that is created from the properties that have been set on the builder.Parser.Builder
option(java.lang.String longName, java.lang.String help)
Adds an option argument that accepts no value.Parser.Builder
option(java.lang.String shortName, java.lang.String longName, java.lang.String help)
Adds an option argument that accepts no value.Parser.Builder
parameter(java.lang.String longName, java.lang.String help)
Adds an argument that accepts a single value.Parser.Builder
parameter(java.lang.String shortName, java.lang.String longName, java.lang.String help)
Adds an argument that accepts a single value.Parser.Builder
positional(java.lang.String name, java.lang.String help)
Configures the name of positional arguments that come after options and parameters.Parser.Builder
repeatedParameter(java.lang.String longName, java.lang.String help)
Adds an argument that accepts a value that can be repeated.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.
-
-
-
Method Detail
-
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 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.
-
-