Class ParserMetadata<T>


  • public class ParserMetadata<T>
    extends java.lang.Object
    Represents meta-data about the parser configuration
    • 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
      • argsSeparator

        private final java.lang.String argsSeparator
      • flagNegationPrefix

        private final java.lang.String flagNegationPrefix
      • 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 like AirlineModule 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 the jakarta-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 class java.lang.Object