Package ai.velr

Class Cell

java.lang.Object
ai.velr.Cell

public final class Cell extends Object
One value returned by a Velr result table.

Cells expose the storage class used by tabular query results. Primitive values can be read through type-specific accessors. JSON cells contain a UTF-8 JSON rendering of richer Cypher values such as lists, maps, nodes, relationships, and paths.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Return this cell as a boolean.
    byte[]
    Return the raw byte payload for text and JSON cells.
    double
    Return this cell as a double.
    long
    Return this cell as a signed 64-bit integer.
    Convert this cell to a simple Java value.
    Return this text or JSON cell as a string.
    static Cell
    bool(boolean value)
    Create a boolean cell.
    static Cell
    doubleValue(double value)
    Create a floating-point cell.
    static Cell
    int64(long value)
    Create a signed 64-bit integer cell.
    static Cell
    json(byte[] bytes)
    Create a JSON cell from UTF-8 bytes.
    static Cell
    Create a null cell.
    static Cell
    text(byte[] bytes)
    Create a text cell from UTF-8 bytes.
    Return a string representation of the Java value.
    Return the cell kind.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • nullValue

      public static Cell nullValue()
      Create a null cell.
      Returns:
      null cell
    • bool

      public static Cell bool(boolean value)
      Create a boolean cell.
      Parameters:
      value - boolean value
      Returns:
      boolean cell
    • int64

      public static Cell int64(long value)
      Create a signed 64-bit integer cell.
      Parameters:
      value - integer value
      Returns:
      integer cell
    • doubleValue

      public static Cell doubleValue(double value)
      Create a floating-point cell.
      Parameters:
      value - double value
      Returns:
      double cell
    • text

      public static Cell text(byte[] bytes)
      Create a text cell from UTF-8 bytes.
      Parameters:
      bytes - UTF-8 text bytes
      Returns:
      text cell
    • json

      public static Cell json(byte[] bytes)
      Create a JSON cell from UTF-8 bytes.
      Parameters:
      bytes - UTF-8 JSON bytes
      Returns:
      JSON cell
    • type

      public CellType type()
      Return the cell kind.
      Returns:
      cell type
    • asBoolean

      public boolean asBoolean()
      Return this cell as a boolean.
      Returns:
      boolean value
      Throws:
      VelrException - if this cell is not CellType.BOOL
    • asLong

      public long asLong()
      Return this cell as a signed 64-bit integer.
      Returns:
      integer value
      Throws:
      VelrException - if this cell is not CellType.INT64
    • asDouble

      public double asDouble()
      Return this cell as a double.
      Returns:
      double value
      Throws:
      VelrException - if this cell is not CellType.DOUBLE
    • asString

      public String asString()
      Return this text or JSON cell as a string.
      Returns:
      UTF-8 decoded text or JSON
      Throws:
      VelrException - if this cell is not CellType.TEXT or CellType.JSON
    • asBytes

      public byte[] asBytes()
      Return the raw byte payload for text and JSON cells.

      For non-byte-backed cell types this returns an empty array.

      Returns:
      copied byte payload
    • asObject

      public Object asObject()
      Convert this cell to a simple Java value.

      Returns null, Boolean, Long, Double, or String. JSON cells are returned as their canonical JSON string.

      Returns:
      Java value
    • toString

      public String toString()
      Return a string representation of the Java value.
      Overrides:
      toString in class Object
      Returns:
      display string