TResult
- - type of the resulting object.public abstract class TextParser<TResult>
extends java.lang.Object
Constructor and Description |
---|
TextParser() |
Modifier and Type | Method and Description |
---|---|
protected java.util.Queue<java.lang.String> |
getParameterQueue(java.lang.String text)
Reads tokens from (delimited by a vertical bar) a query rule body.
|
TResult |
parse(java.util.Queue<java.lang.String> tokens)
Transforms the head of the queue into a string of objects.
|
abstract TResult |
parse(java.lang.String text)
Transforms the given text into an object.
|
static java.lang.Integer |
tryParse(java.lang.String input)
Attempt to parse integer.
|
static java.lang.Integer |
tryParse(java.lang.String input,
java.lang.Integer defaultValue)
Attempt to parse integer.
|
public abstract TResult parse(java.lang.String text) throws ParsingException
text
- - text to parse.ParsingException
- The text cannot be transformed into a list of objects.public TResult parse(java.util.Queue<java.lang.String> tokens) throws ParsingException
tokens
- - queue of tokens.ParsingException
- The head cannot be transformed into a list of objects.protected java.util.Queue<java.lang.String> getParameterQueue(java.lang.String text)
text
- - query rule body to read.public static java.lang.Integer tryParse(java.lang.String input)
input
- - text of the integer to parse.public static java.lang.Integer tryParse(java.lang.String input, java.lang.Integer defaultValue)
input
- - text of the integer to parse.defaultValue
- - value to return if the parsing was unsuccessful.