Class ParseLog

java.lang.Object
net.time4j.format.expert.ParseLog

public class ParseLog extends Object

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

    Constructors
    Constructor
    Description
    Standard constructor with start position at begin of text.
    ParseLog​(int offset)
    Creates a new instance with given start position.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the position of error in text.
    Returns an error message.
    int
    Returns the current position of the parser.
    Yields the parsed raw data as chronological entity.
    boolean
    Queries if an error has occurred.
    void
    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
    Sets a warning to indicate if the current formatter should try to use default values for chronological elements which could not be parsed.
    Debugging support.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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

      public String getErrorMessage()

      Returns an error message.

      Returns:
      String (empty if there is no error)
      Since:
      3.0
    • getRawValues

      public ChronoEntity<?> getRawValues()

      Yields the parsed raw data as chronological entity.

      Returns:
      parsed values as mutable serializable map-like entity without chronology
      Since:
      3.0
    • toString

      public String toString()

      Debugging support.

      Overrides:
      toString in class Object
    • 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

      public void setError(int errorIndex, String errorMessage)

      Sets an error information.

      Parameters:
      errorIndex - error index in parsed text
      errorMessage - 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