Module ojalgo

Class DetectingParser<T>

java.lang.Object
org.ojalgo.netio.DetectingParser<T>
All Implemented Interfaces:
BasicParser<T>, TextLineReader.Parser<T>
Direct Known Subclasses:
DatePriceParser

public abstract class DetectingParser<T> extends Object implements BasicParser<T>
Will detect which delegate parser to use. Must be able to determine that from the first line read. You supply a collection of parsers paired with logic to test if they can handle the proposed line or not.
Author:
apete
See Also:
  • Constructor Details

  • Method Details

    • parse

      public T parse(String line)
      Description copied from interface: TextLineReader.Parser
      Parse one line into some custom object. Returning null indicates that parsing failed!
      Specified by:
      parse in interface TextLineReader.Parser<T>
      Parameters:
      line - The text line to parse
      Returns:
      An object containing (referencing) the parsed data
    • addPotentialParser

      protected void addPotentialParser(Predicate<String> predicate, TextLineReader.Parser<? extends T> parser)