Interface ModelReader

All Superinterfaces:
AutoCloseable

public interface ModelReader extends AutoCloseable
DMR reader. Instances of this interface are not thread safe.
Author:
Richard Opalka
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Free resources associated with this reader.
    Converts available context data to big decimal instance.
    Converts available context data to big integer instance.
    boolean
    Converts available context data to boolean.
    byte[]
    Converts available context data to bytes.
    double
    Converts available context data to double.
    Converts available context data to expression.
    int
    Converts available context data to int.
    long
    Converts available context data to long.
    Converts available context data to String.
    Converts available context data to model type.
    boolean
    Detects if there is next DMR parsing event available.
    boolean
    Returns true if current DMR parsing event is DMR big decimal, false otherwise.
    boolean
    Returns true if current DMR parsing event is DMR big integer, false otherwise.
    boolean
    Returns true if current DMR parsing event is DMR boolean token, false otherwise.
    boolean
    Returns true if current DMR parsing event is DMR bytes, false otherwise.
    boolean
    Returns true if current DMR parsing event is DMR double, false otherwise.
    boolean
    Returns true if current DMR parsing event is DMR expression, false otherwise.
    boolean
    Returns true if current DMR parsing event is DMR int, false otherwise.
    boolean
    Returns true if current DMR parsing event is DMR list end token, false otherwise.
    boolean
    Returns true if current DMR parsing event is DMR list start token, false otherwise.
    boolean
    Returns true if current DMR parsing event is DMR long, false otherwise.
    boolean
    Returns true if current DMR parsing event is DMR object end token, false otherwise.
    boolean
    Returns true if current DMR parsing event is DMR object start token, false otherwise.
    boolean
    Returns true if current DMR parsing event is DMR property end token, false otherwise.
    boolean
    Returns true if current DMR parsing event is DMR property start token, false otherwise.
    boolean
    Returns true if current DMR parsing event is DMR string, false otherwise.
    boolean
    Returns true if current DMR parsing event is DMR type, false otherwise.
    boolean
    Returns true if current DMR parsing event is DMR undefined token, false otherwise.
    Returns next DMR parsing event.
  • Method Details

    • hasNext

      boolean hasNext()
      Detects if there is next DMR parsing event available. Users should call this method before calling next() method.
      Returns:
      true if there are more DMR parsing events, false otherwise
    • next

      Returns next DMR parsing event. Users should call hasNext() before calling this method.
      Returns:
      ModelEvent next event
      Throws:
      IOException - if some I/O error occurs
      ModelException - if wrong DMR is detected
    • isObjectStart

      boolean isObjectStart()
      Returns true if current DMR parsing event is DMR object start token, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor position points to DMR object start token, false otherwise
    • isObjectEnd

      boolean isObjectEnd()
      Returns true if current DMR parsing event is DMR object end token, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor position points to DMR object end token, false otherwise
    • isPropertyStart

      boolean isPropertyStart()
      Returns true if current DMR parsing event is DMR property start token, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor position points to DMR property start token, false otherwise
    • isPropertyEnd

      boolean isPropertyEnd()
      Returns true if current DMR parsing event is DMR property end token, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor position points to DMR property end token, false otherwise
    • isListStart

      boolean isListStart()
      Returns true if current DMR parsing event is DMR list start token, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor position points to DMR list start token, false otherwise
    • isListEnd

      boolean isListEnd()
      Returns true if current DMR parsing event is DMR list end token, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor position points to DMR list end token, false otherwise
    • isUndefined

      boolean isUndefined()
      Returns true if current DMR parsing event is DMR undefined token, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor position points to DMR undefined token, false otherwise
    • isType

      boolean isType()
      Returns true if current DMR parsing event is DMR type, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor position points to DMR type, false otherwise
    • getType

      ModelType getType()
      Converts available context data to model type. Users have to call next() and should call isType() before calling this method.
      Returns:
      type the parsing cursor is pointing to
      Throws:
      IllegalStateException - if cursor isn't pointing to DMR type
    • isString

      boolean isString()
      Returns true if current DMR parsing event is DMR string, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor position points to DMR string, false otherwise
    • getString

      String getString()
      Converts available context data to String. Users have to call next() and should call isString() before calling this method.
      Returns:
      string the parsing cursor is pointing to
      Throws:
      IllegalStateException - if cursor isn't pointing to DMR String
    • isExpression

      boolean isExpression()
      Returns true if current DMR parsing event is DMR expression, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor position points to DMR expression, false otherwise
    • getExpression

      String getExpression()
      Converts available context data to expression. Users have to call next() and should call isExpression() before calling this method.
      Returns:
      expression the parsing cursor is pointing to
      Throws:
      IllegalStateException - if cursor isn't pointing to DMR expression
    • isBytes

      boolean isBytes()
      Returns true if current DMR parsing event is DMR bytes, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor position points to DMR bytes, false otherwise
    • getBytes

      byte[] getBytes()
      Converts available context data to bytes. Users have to call next() and should call isBytes() before calling this method.
      Returns:
      bytes the parsing cursor is pointing to
      Throws:
      IllegalStateException - if cursor isn't pointing to DMR Bytes
    • isBoolean

      boolean isBoolean()
      Returns true if current DMR parsing event is DMR boolean token, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor points to DMR boolean tokens, false otherwise
    • getBoolean

      boolean getBoolean()
      Converts available context data to boolean. Users have to call next() and should call isBoolean() before calling this method.
      Returns:
      boolean value the parsing cursor is pointing to
      Throws:
      IllegalStateException - if cursor isn't pointing to DMR boolean token
    • isInt

      boolean isInt()
      Returns true if current DMR parsing event is DMR int, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor points to DMR int, false otherwise
    • getInt

      int getInt()
      Converts available context data to int. Users have to call next() and should call isInt() before calling this method.
      Returns:
      int value the parsing cursor is pointing to
    • isLong

      boolean isLong()
      Returns true if current DMR parsing event is DMR long, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor points to DMR int, false otherwise
    • getLong

      long getLong()
      Converts available context data to long. Users have to call next() and should call isLong() before calling this method.
      Returns:
      long value the parsing cursor is pointing to
    • isDouble

      boolean isDouble()
      Returns true if current DMR parsing event is DMR double, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor points to DMR double, false otherwise
    • getDouble

      double getDouble()
      Converts available context data to double. Users have to call next() and should call isDouble() before calling this method.
      Returns:
      double value the parsing cursor is pointing to
    • isBigInteger

      boolean isBigInteger()
      Returns true if current DMR parsing event is DMR big integer, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor points to DMR big integer, false otherwise
    • getBigInteger

      BigInteger getBigInteger()
      Converts available context data to big integer instance. Users have to call next() and should call isBigInteger() before calling this method.
      Returns:
      big integer value the parsing cursor is pointing to
    • isBigDecimal

      boolean isBigDecimal()
      Returns true if current DMR parsing event is DMR big decimal, false otherwise. Users have to call next() before calling this method.
      Returns:
      true if the parsing cursor points to DMR big decimal, false otherwise
    • getBigDecimal

      BigDecimal getBigDecimal()
      Converts available context data to big decimal instance. Users have to call next() and should call isBigDecimal() before calling this method.
      Returns:
      big decimal value the parsing cursor is pointing to
    • close

      void close() throws ModelException
      Free resources associated with this reader. Never closes underlying output stream or reader.
      Specified by:
      close in interface AutoCloseable
      Throws:
      ModelException - if attempting to close this reader before reaching EOF.