public class ParseLog extends Object
Represents a log for the current status and error informations during parsing.
Note: This class is not thread-safe. Therefore a new instance is to be created per thread (usually per parsing process).
| Constructor and Description |
|---|
ParseLog()
Standard constructor with start position at begin of text.
|
ParseLog(int offset)
Creates a new instance with given start position.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getErrorIndex()
Returns the position of error in text.
|
String |
getErrorMessage()
Returns an error message.
|
int |
getPosition()
Returns the current position of the parser.
|
ChronoEntity<?> |
getRawValues()
Yields the parsed raw data as chronological entity.
|
boolean |
isError()
Queries if an error has occurred.
|
void |
reset()
Reuses this instance for next parse process.
|
void |
setError(int errorIndex,
String errorMessage)
Sets an error information.
|
void |
setPosition(int position)
Sets the current position of the parser to given new position.
|
void |
setWarning()
Sets a warning to indicate if the current formatter should try
to use default values for chronological elements which could not
be parsed.
|
String |
toString()
Debugging support.
|
public ParseLog()
Standard constructor with start position at begin of text.
public ParseLog(int offset)
Creates a new instance with given start position.
offset - start position where parsing of text beginsIllegalArgumentException - if the start position is negativepublic int getPosition()
Returns the current position of the parser.
>= 0)public boolean isError()
Queries if an error has occurred.
public int getErrorIndex()
Returns the position of error in text.
>= 0 in case of error else -1)public String getErrorMessage()
Returns an error message.
public ChronoEntity<?> getRawValues()
Yields the parsed raw data as chronological entity.
public void setPosition(int position)
Sets the current position of the parser to given new position.
position - new parse position (>= 0)IllegalArgumentException - if given position is negativepublic void setError(int errorIndex,
String errorMessage)
Sets an error information.
errorIndex - error index in parsed texterrorMessage - error message maybe emptyIllegalArgumentException - if given error index is negativepublic void setWarning()
Sets a warning to indicate if the current formatter should try to use default values for chronological elements which could not be parsed.
If there is no error present then an unspecific error message
will be created, too. Only customized ChronoParser-objects
might need to call this method.
ChronoParserpublic void reset()
Reuses this instance for next parse process.
Copyright © 2014–2017. All rights reserved.