Interface CommandOption
- All Known Implementing Classes:
CommandOption.DefaultCommandOption
public interface CommandOption
Interface representing an option in a command.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Gets a maximum arity.int
Gets a minimum arity.Gets a completion function.Gets a default value of an option.Gets a description of an option.getLabel()
Gets a label.String[]
Gets a long names of an option.String[]
Gets a modified long names of an option.int
Gets a positional value.Gets a short names of an option.org.springframework.core.ResolvableType
getType()
Gets aResolvableType
of an option.boolean
Gets a flag if option is required.static CommandOption
Gets an instance of a defaultCommandOption
.static CommandOption
of
(String[] longNames, Character[] shortNames, String description, org.springframework.core.ResolvableType type) Gets an instance of a defaultCommandOption
.static CommandOption
of
(String[] longNames, String[] longNamesModified, Character[] shortNames, String description, org.springframework.core.ResolvableType type, boolean required, String defaultValue, Integer position, Integer arityMin, Integer arityMax, String label, CompletionResolver completion) Gets an instance of a defaultCommandOption
.
-
Method Details
-
getLongNames
String[] getLongNames()Gets a long names of an option.- Returns:
- long names of an option
-
getLongNamesModified
String[] getLongNamesModified()Gets a modified long names of an option. Set within a command registration if option name modifier were used to have an info about original names.- Returns:
- modified long names of an option
-
getShortNames
Character[] getShortNames()Gets a short names of an option.- Returns:
- short names of an option
-
getDescription
String getDescription()Gets a description of an option.- Returns:
- description of an option
-
getType
org.springframework.core.ResolvableType getType()Gets aResolvableType
of an option.- Returns:
- type of an option
-
isRequired
boolean isRequired()Gets a flag if option is required.- Returns:
- the required flag
-
getDefaultValue
String getDefaultValue()Gets a default value of an option.- Returns:
- the default value
-
getPosition
int getPosition()Gets a positional value.- Returns:
- the positional value
-
getArityMin
int getArityMin()Gets a minimum arity.- Returns:
- the minimum arity
-
getArityMax
int getArityMax()Gets a maximum arity.- Returns:
- the maximum arity
-
getLabel
String getLabel()Gets a label.- Returns:
- the label
-
getCompletion
CompletionResolver getCompletion()Gets a completion function.- Returns:
- the completion function
-
of
Gets an instance of a defaultCommandOption
.- Parameters:
longNames
- the long namesshortNames
- the short namesdescription
- the description- Returns:
- default command option
-
of
static CommandOption of(String[] longNames, Character[] shortNames, String description, org.springframework.core.ResolvableType type) Gets an instance of a defaultCommandOption
.- Parameters:
longNames
- the long namesshortNames
- the short namesdescription
- the descriptiontype
- the type- Returns:
- default command option
-
of
static CommandOption of(String[] longNames, String[] longNamesModified, Character[] shortNames, String description, org.springframework.core.ResolvableType type, boolean required, String defaultValue, Integer position, Integer arityMin, Integer arityMax, String label, CompletionResolver completion) Gets an instance of a defaultCommandOption
.- Parameters:
longNames
- the long nameslongNamesModified
- the modified long namesshortNames
- the short namesdescription
- the descriptiontype
- the typerequired
- the required flagdefaultValue
- the default valueposition
- the position valuearityMin
- the min arityarityMax
- the max aritylabel
- the labelcompletion
- the completion- Returns:
- default command option
-