- java.lang.Object
-
- com.github.rvesse.airline.model.ParserMetadata<T>
-
public class ParserMetadata<T> extends java.lang.ObjectRepresents meta-data about the parser configuration
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<AliasMetadata>aliasesprivate booleanaliasesMayChainprivate booleanaliasesOverrideBuiltInsprivate booleanallowAbbreviatedCommandsprivate booleanallowAbbreviatedOptionsprivate java.lang.StringargsSeparatorprivate CommandFactory<T>commandFactoryprivate java.util.Set<java.lang.String>compositionAnnotationClassesstatic java.lang.StringDEFAULT_ARGUMENTS_SEPARATORDefault separator used to separate arguments from optionsprivate ParserErrorHandlererrorHandlerprivate java.lang.StringflagNegationPrefixprivate charforceBuiltInPrefixprivate java.util.List<OptionParser<T>>optionParsersprivate TypeConvertertypeConverterprivate 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 booleanaliasesMayChain()Gets whether aliases may chain i.e.booleanaliasesOverrideBuiltIns()Gets whether aliases can override built-in commandsbooleanallowsAbbreviatedCommands()Gets whether command/group name abbreviation is allowedbooleanallowsAbbreviatedOptions()Gets whether option name abbreviation is allowedbooleanallowsFlagNegation()Gets whether this configuration allows flag negationjava.util.List<AliasMetadata>getAliases()Gets the defined command aliaseschargetAliasForceBuiltInPrefix()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.StringgetArgumentsSeparator()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.ParserErrorHandlergetErrorHandler()Gets the error handler to usejava.lang.StringgetFlagNegationPrefix()Gets the flag negation prefix that is in use (if any)java.util.List<OptionParser<T>>getOptionParsers()Gets the option parsers to useTypeConvertergetTypeConverter()Gets the type converter to useUserAliasesSource<T>getUserAliasesSource()Gets the user aliases source (if any)java.lang.StringtoString()
-
-
-
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 likeAirlineModulethat 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
AirlineModuleannotation to allow better integrating Airline with a dependency injection framework, and to ultimately enable removing its current dependency on thejakarta-injectlibrary.- 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
nullif not enabled
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-