Class AbstractNameValueOptionParser<T>

  • All Implemented Interfaces:
    OptionParser<T>
    Direct Known Subclasses:
    ColonSeparatedOptionParser, LongGetOptParser

    public abstract class AbstractNameValueOptionParser<T>
    extends AbstractOptionParser<T>
    Abstract option parser for options that are specified in --name=value style while the separator character (in this example =) can be configured as desired.

    The separator must be a non-whitespace character.

    • Field Detail

      • separator

        private final char separator
    • Constructor Detail

      • AbstractNameValueOptionParser

        public AbstractNameValueOptionParser()
        Creates a new parser with the default separator (=)
      • AbstractNameValueOptionParser

        public AbstractNameValueOptionParser​(char sep)
        Creates a new parser with the desired separator character
        Parameters:
        sep - Separator character, must be non-whitespace
    • Method Detail

      • parseOptions

        public ParseState<T> parseOptions​(org.apache.commons.collections4.iterators.PeekingIterator<java.lang.String> tokens,
                                          ParseState<T> state,
                                          java.util.List<OptionMetadata> allowedOptions)
        Description copied from interface: OptionParser
        Parses one/more options from the token stream
        Parameters:
        tokens - Tokens
        state - Current parser state
        allowedOptions - Allowed options at this point of the parsing
        Returns:
        New parser state, may return null if this parser could not parse the next token as an option