Class ParseLog
Represents a log for the current status and error informations during parsing.
Note: This class is not threadsafe. Therefore a new instance is to be created per thread (usually per parsing process).
- Since:
- 3.0
- Author:
- Meno Hochschild
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns the position of error in text.Returns an error message.int
Returns the current position of the parser.ChronoEntity<?>
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
Sets an error information.void
setPosition(int position)
Sets the current position of the parser to given new position.void
Sets a warning to indicate if the current formatter should try to use default values for chronological elements which could not be parsed.toString()
Debugging support.
-
Constructor Details
-
ParseLog
public ParseLog()Standard constructor with start position at begin of text.
- Since:
- 3.0
-
ParseLog
public ParseLog(int offset)Creates a new instance with given start position.
- Parameters:
offset
- start position where parsing of text begins- Throws:
IllegalArgumentException
- if the start position is negative- Since:
- 3.0
-
-
Method Details
-
getPosition
public int getPosition()Returns the current position of the parser.
- Returns:
- int (
>= 0
) - Since:
- 3.0
-
isError
public boolean isError()Queries if an error has occurred.
- Returns:
- boolean
- Since:
- 3.0
-
getErrorIndex
public int getErrorIndex()Returns the position of error in text.
- Returns:
- int (
>= 0
in case of error else-1
) - Since:
- 3.0
-
getErrorMessage
Returns an error message.
- Returns:
- String (empty if there is no error)
- Since:
- 3.0
-
getRawValues
Yields the parsed raw data as chronological entity.
- Returns:
- parsed values as mutable serializable map-like entity without chronology
- Since:
- 3.0
-
toString
Debugging support.
-
setPosition
public void setPosition(int position)Sets the current position of the parser to given new position.
- Parameters:
position
- new parse position (>= 0
)- Throws:
IllegalArgumentException
- if given position is negative- Since:
- 3.0
-
setError
Sets an error information.
- Parameters:
errorIndex
- error index in parsed texterrorMessage
- error message maybe empty- Throws:
IllegalArgumentException
- if given error index is negative- Since:
- 3.0
-
setWarning
public 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.- Since:
- 3.0
- See Also:
ChronoParser
-
reset
public void reset()Reuses this instance for next parse process.
- Since:
- 3.0
-