Class ListParser

  • Direct Known Subclasses:
    CommaSeparatedVariableParser

    public class ListParser
    extends MetaPatternParser
    Parses an arbitrary list format with a pattern for list entries and a pattern for list separators.
    Author:
    Jonathan Locke
    • Constructor Summary

      Constructors 
      Constructor Description
      ListParser​(MetaPattern entryPattern, MetaPattern separatorPattern, java.lang.CharSequence input)
      Constructs a list parser from an entry MetaPattern, a separator MetaPattern and an input character sequence.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<java.lang.String> getValues()
      Gets the parsed values.
      boolean matches()
      Parse the input and add the elements to an internal list to be accessed by
      • Methods inherited from class java.lang.Object

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

      • ListParser

        public ListParser​(MetaPattern entryPattern,
                          MetaPattern separatorPattern,
                          java.lang.CharSequence input)
        Constructs a list parser from an entry MetaPattern, a separator MetaPattern and an input character sequence.
        Parameters:
        entryPattern - The pattern in between the separators
        separatorPattern - The separator pattern
        input - The input to parse
    • Method Detail

      • getValues

        public final java.util.List<java.lang.String> getValues()
        Gets the parsed values. It depends on the elements pattern, whether empty elements, double or single quotes or escape characters are supported.
        Returns:
        the parsed values