- java.lang.Object
-
- com.github.rvesse.airline.model.ParserMetadata<T>
-
public class ParserMetadata<T> extends java.lang.Object
Represents meta-data about the parser configuration
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<AliasMetadata>
aliases
private boolean
aliasesMayChain
private boolean
aliasesOverrideBuiltIns
private boolean
allowAbbreviatedCommands
private boolean
allowAbbreviatedOptions
private java.lang.String
argsSeparator
private CommandFactory<T>
commandFactory
private java.util.Set<java.lang.String>
compositionAnnotationClasses
static java.lang.String
DEFAULT_ARGUMENTS_SEPARATOR
Default separator used to separate arguments from optionsprivate ParserErrorHandler
errorHandler
private java.lang.String
flagNegationPrefix
private char
forceBuiltInPrefix
private java.util.List<OptionParser<T>>
optionParsers
private TypeConverter
typeConverter
private UserAliasesSource<T>
userAliases
-
Constructor Summary
Constructors Constructor Description ParserMetadata(CommandFactory<T> commandFactory, java.util.Collection<java.lang.String> compositionAnnotationClasses, java.util.Collection<OptionParser<T>> optionParsers, TypeConverter typeConverter, ParserErrorHandler errorHandler, boolean allowAbbreviateCommands, boolean allowAbbreviatedOptions, java.util.Collection<AliasMetadata> aliases, UserAliasesSource<T> userAliases, boolean aliasesOverrideBuiltIns, boolean aliasesMayChain, char forceBuiltInPrefix, java.lang.String argumentsSeparator, java.lang.String flagNegationPrefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
aliasesMayChain()
Gets whether aliases may chain i.e.boolean
aliasesOverrideBuiltIns()
Gets whether aliases can override built-in commandsboolean
allowsAbbreviatedCommands()
Gets whether command/group name abbreviation is allowedboolean
allowsAbbreviatedOptions()
Gets whether option name abbreviation is allowedboolean
allowsFlagNegation()
Gets whether this configuration allows flag negationjava.util.List<AliasMetadata>
getAliases()
Gets the defined command aliaseschar
getAliasForceBuiltInPrefix()
Gets the prefix character used in alias definitions to indicate that when resolving an alias that it should force the built-in to be called even if there is an alias of that name and built-in overriding is enabledjava.lang.String
getArgumentsSeparator()
Gets the arguments separator to be usedCommandFactory<T>
getCommandFactory()
Gets the command factory to usejava.util.Collection<java.lang.String>
getCompositionAnnotations()
Gets the set of annotation class names to follow when building the metadata for commands i.e.ParserErrorHandler
getErrorHandler()
Gets the error handler to usejava.lang.String
getFlagNegationPrefix()
Gets the flag negation prefix that is in use (if any)java.util.List<OptionParser<T>>
getOptionParsers()
Gets the option parsers to useTypeConverter
getTypeConverter()
Gets the type converter to useUserAliasesSource<T>
getUserAliasesSource()
Gets the user aliases source (if any)java.lang.String
toString()
-
-
-
Field Detail
-
DEFAULT_ARGUMENTS_SEPARATOR
public static final java.lang.String DEFAULT_ARGUMENTS_SEPARATOR
Default separator used to separate arguments from options- See Also:
- Constant Field Values
-
allowAbbreviatedCommands
private final boolean allowAbbreviatedCommands
-
allowAbbreviatedOptions
private final boolean allowAbbreviatedOptions
-
aliasesOverrideBuiltIns
private final boolean aliasesOverrideBuiltIns
-
aliasesMayChain
private final boolean aliasesMayChain
-
optionParsers
private final java.util.List<OptionParser<T>> optionParsers
-
aliases
private final java.util.List<AliasMetadata> aliases
-
userAliases
private final UserAliasesSource<T> userAliases
-
typeConverter
private final TypeConverter typeConverter
-
commandFactory
private final CommandFactory<T> commandFactory
-
argsSeparator
private final java.lang.String argsSeparator
-
flagNegationPrefix
private final java.lang.String flagNegationPrefix
-
errorHandler
private final ParserErrorHandler errorHandler
-
forceBuiltInPrefix
private final char forceBuiltInPrefix
-
compositionAnnotationClasses
private final java.util.Set<java.lang.String> compositionAnnotationClasses
-
-
Constructor Detail
-
ParserMetadata
public ParserMetadata(CommandFactory<T> commandFactory, java.util.Collection<java.lang.String> compositionAnnotationClasses, java.util.Collection<OptionParser<T>> optionParsers, TypeConverter typeConverter, ParserErrorHandler errorHandler, boolean allowAbbreviateCommands, boolean allowAbbreviatedOptions, java.util.Collection<AliasMetadata> aliases, UserAliasesSource<T> userAliases, boolean aliasesOverrideBuiltIns, boolean aliasesMayChain, char forceBuiltInPrefix, java.lang.String argumentsSeparator, java.lang.String flagNegationPrefix)
-
-
Method Detail
-
getCommandFactory
public CommandFactory<T> getCommandFactory()
Gets the command factory to use- Returns:
- Command factory
-
getCompositionAnnotations
public java.util.Collection<java.lang.String> getCompositionAnnotations()
Gets the set of annotation class names to follow when building the metadata for commands i.e. these are the annotations likeAirlineModule
that indicate that a field has a type that should be inspected for further metadata used to build up a commands options and arguments.This configuration point was introduced in 2.9.0 along with the
AirlineModule
annotation to allow better integrating Airline with a dependency injection framework, and to ultimately enable removing its current dependency on thejakarta-inject
library.- Returns:
- Collection of injection annotation class names
- Since:
- 2.9.0
-
getTypeConverter
public TypeConverter getTypeConverter()
Gets the type converter to use- Returns:
- Type converter
-
getErrorHandler
public ParserErrorHandler getErrorHandler()
Gets the error handler to use- Returns:
- Error handler
-
getAliases
public java.util.List<AliasMetadata> getAliases()
Gets the defined command aliases- Returns:
- Aliases
-
getUserAliasesSource
public UserAliasesSource<T> getUserAliasesSource()
Gets the user aliases source (if any)- Returns:
- User aliases source
-
aliasesOverrideBuiltIns
public boolean aliasesOverrideBuiltIns()
Gets whether aliases can override built-in commands- Returns:
- True if they can override, false otherwise
-
aliasesMayChain
public boolean aliasesMayChain()
Gets whether aliases may chain i.e. whether one alias may reference another- Returns:
- True if they can chain, false otherwise
-
getAliasForceBuiltInPrefix
public char getAliasForceBuiltInPrefix()
Gets the prefix character used in alias definitions to indicate that when resolving an alias that it should force the built-in to be called even if there is an alias of that name and built-in overriding is enabled- Returns:
- Force built in prefix character
-
getOptionParsers
public java.util.List<OptionParser<T>> getOptionParsers()
Gets the option parsers to use- Returns:
- Option parsers
-
allowsAbbreviatedCommands
public boolean allowsAbbreviatedCommands()
Gets whether command/group name abbreviation is allowed- Returns:
- True if allowed, false otherwise
-
allowsAbbreviatedOptions
public boolean allowsAbbreviatedOptions()
Gets whether option name abbreviation is allowed- Returns:
- True if allowed, false otherwise
-
getArgumentsSeparator
public java.lang.String getArgumentsSeparator()
Gets the arguments separator to be used- Returns:
- Arguments separator
-
allowsFlagNegation
public boolean allowsFlagNegation()
Gets whether this configuration allows flag negation- Returns:
- True if negation is allowed, false otherwise
-
getFlagNegationPrefix
public java.lang.String getFlagNegationPrefix()
Gets the flag negation prefix that is in use (if any)- Returns:
- Flag negation prefix, may be
null
if not enabled
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-