Interface ChronoParser<T>

Type Parameters:
T - generic type of chronological entity to be parsed
All Known Implementing Classes:
ChronoFormatter, MultiFormatParser

public interface ChronoParser<T>

Interpretes a text as chronological entity.

Since:
3.0
Author:
Meno Hochschild
See Also:
ChronoEntity
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the global format attributes which are active if they are not overridden by sectional attributes.
    default T
    Interpretes given text as chronological entity starting at the begin of text.
    default T
    parse​(CharSequence text, ParseLog status)
    Interpretes given text as chronological entity starting at the specified position in parse log.
    parse​(CharSequence text, ParseLog status, AttributeQuery attributes)
    Interpretes given text as chronological entity starting at the specified position in parse log.
    static <T> ChronoParser<T>
    Creates a simple placeholder in situations where parsing is not used.
  • Method Details

    • parse

      default T parse(CharSequence text) throws ParseException

      Interpretes given text as chronological entity starting at the begin of text.

      Parameters:
      text - text to be parsed
      Returns:
      parse result
      Throws:
      IndexOutOfBoundsException - if the text is empty
      ParseException - if the text is not parseable
      Since:
      4.18
    • parse

      default T parse(CharSequence text, ParseLog status)

      Interpretes given text as chronological entity starting at the specified position in parse log.

      Equivalent to parse(text, status, getAttributes()).

      Parameters:
      text - text to be parsed
      status - parser information (always as new instance)
      Returns:
      result or null if parsing does not work
      Throws:
      IndexOutOfBoundsException - if the start position is at end of text or even behind
      Since:
      4.18
    • parse

      T parse(CharSequence text, ParseLog status, AttributeQuery attributes)

      Interpretes given text as chronological entity starting at the specified position in parse log.

      Implementation note: Any implementation will parse the text first at the position status.getPosition() and then set the new position in the parse log if successful. In case of error the error index in the parse log will be updated instead.

      Parameters:
      text - text to be parsed
      status - parser information (always as new instance)
      attributes - control attributes
      Returns:
      result or null if parsing does not work
      Throws:
      IndexOutOfBoundsException - if the start position is at end of text or even behind
    • getAttributes

      default AttributeQuery getAttributes()

      Returns the global format attributes which are active if they are not overridden by sectional attributes.

      Returns:
      global control attributes valid for the whole formatter (can be overridden by sectional attributes however)
      Since:
      4.18
    • unsupported

      static <T> ChronoParser<T> unsupported()

      Creates a simple placeholder in situations where parsing is not used.

      Type Parameters:
      T - generic type of chronological entity to be parsed
      Returns:
      dummy parser
      Since:
      5.9.4