Class CharacterSeparatedList

  • Direct Known Subclasses:
    AcceptEncoding, ParameterizedArgument

    public abstract class CharacterSeparatedList
    extends java.lang.Object
    Abstract class for implementing parsers for character separated lists.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static char CR
      Carriage Return character.
      protected java.lang.String currentString
      Current string being parsed.
      protected static char HT
      Horizontal TAB character.
      protected static char LF
      Line feed character.
      protected char separator
      Characters separator.
      protected static char SP
      Space character.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void endParse()
      End instructions of the string parsing.
      protected abstract java.lang.StringBuilder generate​(java.lang.StringBuilder sb)
      Generates a String representation.
      protected abstract void initializeNbTokens​(int nbTokens)
      Set the number of tokens to read.
      protected abstract void newToken​(int id, int start, int stop)
      Read a new token between the given start and stop index and set its id.
      void parse​(java.lang.String str)
      Parses the given String.
      void parse​(java.lang.String str, int start, int stop)
      Parses the String str from the start index to the stop index.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • currentString

        @Nullable
        protected java.lang.String currentString
        Current string being parsed.
      • separator

        protected char separator
        Characters separator.
    • Constructor Detail

      • CharacterSeparatedList

        public CharacterSeparatedList​(char separator)
        Creates a new instance of CharacterSeparatedList using the character separator as the separator character.
        Parameters:
        separator - the character to treat as characters separator for this list
    • Method Detail

      • endParse

        protected void endParse()
        End instructions of the string parsing.
      • generate

        protected abstract java.lang.StringBuilder generate​(java.lang.StringBuilder sb)
        Generates a String representation.
        Parameters:
        sb - the StringBuffer
        Returns:
        StringBuffer
      • initializeNbTokens

        protected abstract void initializeNbTokens​(int nbTokens)
        Set the number of tokens to read.
        Parameters:
        nbTokens - number of tokens
      • newToken

        protected abstract void newToken​(int id,
                                         int start,
                                         int stop)
        Read a new token between the given start and stop index and set its id.
        Parameters:
        id - for the token
        start - index of the token begin in the string
        stop - index of the token end in the string
      • parse

        public void parse​(java.lang.String str)
        Parses the given String.
        Parameters:
        str - the String to parse
      • parse

        public void parse​(@Nullable
                          java.lang.String str,
                          int start,
                          int stop)
        Parses the String str from the start index to the stop index.
        Parameters:
        str - the String to parse
        start - the start index
        stop - the stop index