FormatToken in-line, when parsing an
input stream using a MonetaryAmountFormat. It allows to inspect the
next tokens, the whole input String, or just the current input substring,
based on the current parsing position etc.
This class is mutable and intended for use by a single thread. A new instance is created for each parse.
| Modifier and Type | Field and Description |
|---|---|
| private int | errorIndex
The error index position. |
| private String | errorMessage
The parse error message. |
| private int | index
The current position of parsing. |
| private final CharSequence | originalInput
The full input. |
| private CurrencyUnit | parsedCurrency
The currency parsed, used for creation of the |
| private Number | parsedNumber
The numeric part of the |
| Access | Constructor and Description |
|---|---|
| pack-priv | ParseContext(CharSequence
The test to be parsed. text)Creates a new |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public boolean | Returns: true, if the character matched and the index could be increased by one.the next character being expected. c)Tries to consume one single character. |
| public int | |
| public String | |
| public int | |
| public CharSequence | Returns: the residual input textGets the residual input text starting from the current parse position. |
| public String | |
| public CurrencyUnit | |
| public Number | |
| public boolean | |
| public boolean | Returns: true, if the item is available.Method allows to determine if the item being parsed is available from the
|
| public boolean | Returns: true if fully parsedChecks if the text has been fully parsed such that there is no more text to parse. |
| public String | Returns: the next token found, or null.This method skips all whitespaces and returns the full text, until another whitespace area or the end of the input is reached. |
| public void | reset()
Resets this instance; this will resetToFallback the parsing position, the error index and also all containing results. |
| public void | |
| public void | |
| public void | |
| public void | setParsedCurrency(CurrencyUnit
The parsed currency currency)Set the parsed currency into the context. |
| public void | |
| public int | Returns: the new parse index after skipping any whitespaces.Skips all whitespaces until a non whitespace character is occurring. |
| public ParsePosition | |
| public String |
| errorIndex | back to summary |
|---|---|
| private int errorIndex The error index position. | |
| errorMessage | back to summary |
|---|---|
| private String errorMessage The parse error message. | |
| index | back to summary |
|---|---|
| private int index The current position of parsing. | |
| originalInput | back to summary |
|---|---|
| private final CharSequence originalInput The full input. | |
| parsedCurrency | back to summary |
|---|---|
| private CurrencyUnit parsedCurrency The currency parsed, used for creation of the | |
| parsedNumber | back to summary |
|---|---|
| private Number parsedNumber The numeric part of the | |
| ParseContext | back to summary |
|---|---|
| pack-priv ParseContext(CharSequence text) Creates a new
| |
| consume | back to summary |
|---|---|
| public boolean consume(String token) Consumes the given token. If the current residual text to be parsed
starts with the parsing index is increased by
| |
| consume | back to summary |
|---|---|
| public boolean consume(char c) Tries to consume one single character.
| |
| getErrorIndex | back to summary |
|---|---|
| public int getErrorIndex() Gets the error index.
| |
| getErrorMessage | back to summary |
|---|---|
| public String getErrorMessage() Get the stored error message.
| |
| getIndex | back to summary |
|---|---|
| public int getIndex() Gets the current parse position.
| |
| getInput | back to summary |
|---|---|
| public CharSequence getInput() Gets the residual input text starting from the current parse position.
| |
| getOriginalInput | back to summary |
|---|---|
| public String getOriginalInput() Gets the full input text.
| |
| getParsedCurrency | back to summary |
|---|---|
| public CurrencyUnit getParsedCurrency() | |
| getParsedNumber | back to summary |
|---|---|
| public Number getParsedNumber() Get the parsed item.
| |
| hasError | back to summary |
|---|---|
| public boolean hasError() Checks if the parse has found an error.
| |
| isComplete | back to summary |
|---|---|
| public boolean isComplete() Method allows to determine if the item being parsed is available from the
| |
| isFullyParsed | back to summary |
|---|---|
| public boolean isFullyParsed() Checks if the text has been fully parsed such that there is no more text to parse.
| |
| lookupNextToken | back to summary |
|---|---|
| public String lookupNextToken() This method skips all whitespaces and returns the full text, until another whitespace area or the end of the input is reached. The method will not update any index pointers.
| |
| reset | back to summary |
|---|---|
| public void reset() Resets this instance; this will resetToFallback the parsing position, the error index and also all containing results. | |
| setError | back to summary |
|---|---|
| public void setError() Sets the error index from the current index. | |
| setErrorIndex | back to summary |
|---|---|
| public void setErrorIndex(int index) Sets the error index.
| |
| setErrorMessage | back to summary |
|---|---|
| public void setErrorMessage(String message) | |
| setParsedCurrency | back to summary |
|---|---|
| public void setParsedCurrency(CurrencyUnit currency) Set the parsed currency into the context.
| |
| setParsedNumber | back to summary |
|---|---|
| public void setParsedNumber(Number number) Sets the parsed numeric value into the context.
| |
| skipWhitespace | back to summary |
|---|---|
| public int skipWhitespace() Skips all whitespaces until a non whitespace character is occurring. If the next character is not whitespace this method does nothing.
| |
| toParsePosition | back to summary |
|---|---|
| public ParsePosition toParsePosition() Converts the indexes to a parse position.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |