Class DetectingParser<T>
java.lang.Object
org.ojalgo.netio.DetectingParser<T>
- All Implemented Interfaces:
BasicParser<T>, TextLineReader.Parser<T>
- Direct Known Subclasses:
DatePriceParser
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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TextLineReader.Parser<T> private TextLineReader.Parser<? extends T> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddPotentialParser(Predicate<String> predicate, TextLineReader.Parser<? extends T> parser) Parse one line into some custom object.
-
Field Details
-
myPotentialParsers
-
mySelectedParser
-
myDefaultParser
-
-
Constructor Details
-
DetectingParser
-
-
Method Details
-
parse
Description copied from interface:TextLineReader.ParserParse one line into some custom object. Returning null indicates that parsing failed!- Specified by:
parsein interfaceTextLineReader.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)
-