Interface Tuple

All Known Subinterfaces:
Row

public interface Tuple
A general purpose tuple.

CAUTION: indexes start at 0, not at 1.

  • Field Details

    • JSON_NULL

      static final Object JSON_NULL
      The JSON null literal value.
      It is used to distinguish a JSON null literal value from the Java null value. This is only used when the database supports JSON types.
  • Method Details

    • tuple

      static Tuple tuple()
      Returns:
      a new empty tuple
    • from

      static <T> Tuple from(List<T> list)
      Wrap the provided list with a tuple.
      The list is not copied and is used as store for tuple elements.
      Returns:
      the list wrapped as a tuple
    • from

      static Tuple from(Object[] array)
      Wrap the provided array with a tuple.
      The array is not copied and is used as store for tuple elements.
      Returns:
      the list wrapped as a tuple
    • wrap

      static <T> Tuple wrap(List<T> list)
      Wrap the provided list with a tuple.
      The list is not copied and is used as store for tuple elements.
      Note: The list might be modified and users should use tuple(List) if the list is unmodifiable
      Returns:
      the list wrapped as a tuple
    • wrap

      static Tuple wrap(Object[] array)
      Wrap the provided array with a tuple.
      The array is not copied and is used as store for tuple elements.
      Returns:
      the list wrapped as a tuple
    • of

      static Tuple of(Object elt1)
      Create a tuple of one element.
      Parameters:
      elt1 - the first value
      Returns:
      the tuple
    • of

      static Tuple of(Object elt1, Object elt2)
      Create a tuple of two elements.
      Parameters:
      elt1 - the first value
      elt2 - the second value
      Returns:
      the tuple
    • of

      static Tuple of(Object elt1, Object elt2, Object elt3)
      Create a tuple of three elements.
      Parameters:
      elt1 - the first value
      elt2 - the second value
      elt3 - the third value
      Returns:
      the tuple
    • of

      static Tuple of(Object elt1, Object elt2, Object elt3, Object elt4)
      Create a tuple of four elements.
      Parameters:
      elt1 - the first value
      elt2 - the second value
      elt3 - the third value
      elt4 - the fourth value
      Returns:
      the tuple
    • of

      static Tuple of(Object elt1, Object elt2, Object elt3, Object elt4, Object elt5)
      Create a tuple of five elements.
      Parameters:
      elt1 - the first value
      elt2 - the second value
      elt3 - the third value
      elt4 - the fourth value
      elt5 - the fifth value
      Returns:
      the tuple
    • of

      static Tuple of(Object elt1, Object elt2, Object elt3, Object elt4, Object elt5, Object elt6)
      Create a tuple of six elements.
      Parameters:
      elt1 - the first value
      elt2 - the second valueg
      elt3 - the third value
      elt4 - the fourth value
      elt5 - the fifth value
      elt6 - the sixth value
      Returns:
      the tuple
    • of

      static Tuple of(Object elt1, Object... elts)
      Create a tuple of an arbitrary number of elements.
      Parameters:
      elt1 - the first element
      elts - the remaining elements
      Returns:
      the tuple
    • tuple

      static Tuple tuple(List<Object> elements)
      Create a tuple with the provided elements list.

      The elements list is not modified.

      Parameters:
      elements - the list of elements
      Returns:
      the tuple
    • getValue

      Object getValue(int pos)
      Get an object value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getBoolean

      default Boolean getBoolean(int pos)
      Get a boolean value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getByte

      default Byte getByte(int pos)
      Get a byte value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getShort

      default Short getShort(int pos)
      Get a short value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getInteger

      default Integer getInteger(int pos)
      Get an integer value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getLong

      default Long getLong(int pos)
      Get a long value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getFloat

      default Float getFloat(int pos)
      Get a float value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getDouble

      default Double getDouble(int pos)
      Get a double value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getNumeric

      default Numeric getNumeric(int pos)
      Get Numeric value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getString

      default String getString(int pos)
      Get a string value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getJsonObject

      default JsonObject getJsonObject(int pos)
      Get a JsonObject value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getJsonArray

      default JsonArray getJsonArray(int pos)
      Get a JsonArray value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getJson

      default Object getJson(int pos)
      Get a JSON element at pos, the element might be null or one of the following types:
      • String
      • Number
      • JsonObject
      • JsonArray
      • Boolean
      Parameters:
      pos - the position
      Returns:
      the value
    • getTemporal

      default Temporal getTemporal(int pos)
      Get a Temporal value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getLocalDate

      default LocalDate getLocalDate(int pos)
      Get LocalDate value at pos.

      Target element instance of LocalDateTime will be coerced to LocalDate.

      Parameters:
      pos - the position
      Returns:
      the value
    • getLocalTime

      default LocalTime getLocalTime(int pos)
      Get LocalTime value at pos.

      Target element instance of LocalDateTime will be coerced to LocalTime.

      Parameters:
      pos - the position
      Returns:
      the value
    • getLocalDateTime

      default LocalDateTime getLocalDateTime(int pos)
      Get LocalDateTime value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getOffsetTime

      default OffsetTime getOffsetTime(int pos)
      Get OffsetTime value at pos.

      Target element instance of OffsetDateTime will be coerced to OffsetTime.

      Parameters:
      pos - the position
      Returns:
      the value
    • getOffsetDateTime

      default OffsetDateTime getOffsetDateTime(int pos)
      Get OffsetDateTime value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getBuffer

      default Buffer getBuffer(int pos)
      Get a buffer value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getUUID

      default UUID getUUID(int pos)
      Get UUID value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getBigDecimal

      default BigDecimal getBigDecimal(int pos)
      Get BigDecimal value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfBooleans

      default Boolean[] getArrayOfBooleans(int pos)
      Get an array of Boolean value at pos.

      Target element instance of Object[] will be coerced to Boolean[].

      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfBytes

      default Byte[] getArrayOfBytes(int pos)
      Get an array of Byte value at pos.

      Target element instance of Number[] or Object[] will be coerced to Byte[].

      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfShorts

      default Short[] getArrayOfShorts(int pos)
      Get an array of Short value at pos.

      Target element instance of Number[] or Object[] will be coerced to Short[].

      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfIntegers

      default Integer[] getArrayOfIntegers(int pos)
      Get an array of Integer value at pos.

      Target element instance of Number[] or Object[] will be coerced to Integer[].

      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfLongs

      default Long[] getArrayOfLongs(int pos)
      Get an array of Long value at pos.

      Target element instance of Number[] or Object[] will be coerced to Long[].

      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfFloats

      default Float[] getArrayOfFloats(int pos)
      Get an array of Float value at pos.

      Target element instance of Number[] or Object[] will be coerced to Float[].

      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfDoubles

      default Double[] getArrayOfDoubles(int pos)
      Get an array of Double value at pos.

      Target element instance of Number[] or Object[] will be coerced to Double[].

      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfNumerics

      default Numeric[] getArrayOfNumerics(int pos)
      Get an array of Numeric value at pos.
      Parameters:
      pos - the column
      Returns:
      the value
    • getArrayOfStrings

      default String[] getArrayOfStrings(int pos)
      Get an array of String value at pos.

      Target element instance of Object[] will be coerced to String[].

      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfJsonObjects

      default JsonObject[] getArrayOfJsonObjects(int pos)
      Get an array of JsonObject value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfJsonArrays

      default JsonArray[] getArrayOfJsonArrays(int pos)
      Get an array of JsonArray value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfJsons

      default Object[] getArrayOfJsons(int pos)
      Get an array of JSON elements at pos, the element might be null or one of the following types:
      • String
      • Number
      • JsonObject
      • JsonArray
      • Boolean
      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfTemporals

      default Temporal[] getArrayOfTemporals(int pos)
      Get an array of Temporal value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfLocalDates

      default LocalDate[] getArrayOfLocalDates(int pos)
      Get an array of LocalDate value at pos.

      Target element instance of LocalDateTime[] will be coerced to LocalDate[].

      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfLocalTimes

      default LocalTime[] getArrayOfLocalTimes(int pos)
      Get an array of LocalTime value at pos.

      Target element instance of LocalDateTime[] will be coerced to LocalTime[].

      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfLocalDateTimes

      default LocalDateTime[] getArrayOfLocalDateTimes(int pos)
      Get an array of LocalDateTime value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfOffsetTimes

      default OffsetTime[] getArrayOfOffsetTimes(int pos)
      Get an array of OffsetTime value at pos.

      Target element instance of OffsetDateTime[] will be coerced to OffsetTime[].

      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfOffsetDateTimes

      default OffsetDateTime[] getArrayOfOffsetDateTimes(int pos)
      Get an array of OffsetDateTime value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfBuffers

      default Buffer[] getArrayOfBuffers(int pos)
      Get an array of Buffer value at pos.
      Parameters:
      pos - the position
      Returns:
      the value
    • getArrayOfUUIDs

      default UUID[] getArrayOfUUIDs(int pos)
      Get an array of UUID value at pos.
      Parameters:
      pos - the column
      Returns:
      the value
    • getArrayOfBigDecimals

      default BigDecimal[] getArrayOfBigDecimals(int pos)
      Get an array of BigDecimal value at pos.
      Parameters:
      pos - the column
      Returns:
      the value
    • addValue

      Tuple addValue(Object value)
      Add an object value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addBoolean

      default Tuple addBoolean(Boolean value)
      Add a boolean value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addShort

      default Tuple addShort(Short value)
      Add a short value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addInteger

      default Tuple addInteger(Integer value)
      Add an integer value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addLong

      default Tuple addLong(Long value)
      Add a long value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addFloat

      default Tuple addFloat(Float value)
      Add a float value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addDouble

      default Tuple addDouble(Double value)
      Add a double value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addString

      default Tuple addString(String value)
      Add a string value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addJsonObject

      default Tuple addJsonObject(JsonObject value)
      Add a JsonObject value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addJsonArray

      default Tuple addJsonArray(JsonArray value)
      Add a JsonArray value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addTemporal

      default Tuple addTemporal(Temporal value)
      Add a Temporal value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addLocalDate

      default Tuple addLocalDate(LocalDate value)
      Add a LocalDate value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addLocalTime

      default Tuple addLocalTime(LocalTime value)
      Add a LocalTime value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addLocalDateTime

      default Tuple addLocalDateTime(LocalDateTime value)
      Add a LocalDateTime value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addOffsetTime

      default Tuple addOffsetTime(OffsetTime value)
      Add a OffsetTime value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addOffsetDateTime

      default Tuple addOffsetDateTime(OffsetDateTime value)
      Add a OffsetDateTime value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addBuffer

      default Tuple addBuffer(Buffer value)
      Add a buffer value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addUUID

      default Tuple addUUID(UUID value)
      Add a UUID value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addBigDecimal

      default Tuple addBigDecimal(BigDecimal value)
      Add a BigDecimal value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfBoolean

      default Tuple addArrayOfBoolean(Boolean[] value)
      Add an array of Boolean value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfShort

      default Tuple addArrayOfShort(Short[] value)
      Add an array of Short value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfInteger

      default Tuple addArrayOfInteger(Integer[] value)
      Add an array of Integer value at the end of the tuple.

      Target element instance of Number[] will be coerced to Integer[].

      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfLong

      default Tuple addArrayOfLong(Long[] value)
      Add an array of Long value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfFloat

      default Tuple addArrayOfFloat(Float[] value)
      Add an array of Float value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfDouble

      default Tuple addArrayOfDouble(Double[] value)
      Add an array of Double value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfString

      default Tuple addArrayOfString(String[] value)
      Add an array of String value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfJsonObject

      default Tuple addArrayOfJsonObject(JsonObject[] value)
      Add an array of JsonObject value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfJsonArray

      default Tuple addArrayOfJsonArray(JsonArray[] value)
      Add an array of JsonArray value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfTemporal

      default Tuple addArrayOfTemporal(Temporal[] value)
      Add an array of Temporal value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfLocalDate

      default Tuple addArrayOfLocalDate(LocalDate[] value)
      Add an array of LocalDate value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfLocalTime

      default Tuple addArrayOfLocalTime(LocalTime[] value)
      Add an array of LocalTime value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfLocalDateTime

      default Tuple addArrayOfLocalDateTime(LocalDateTime[] value)
      Add an array of LocalDateTime value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfOffsetTime

      default Tuple addArrayOfOffsetTime(OffsetTime[] value)
      Add an array of OffsetTime value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfOffsetDateTime

      default Tuple addArrayOfOffsetDateTime(OffsetDateTime[] value)
      Add an array of OffsetDateTime value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfBuffer

      default Tuple addArrayOfBuffer(Buffer[] value)
      Add an array of Buffer value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfUUID

      default Tuple addArrayOfUUID(UUID[] value)
      Add an array of UUID value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • addArrayOfBigDecimal

      default Tuple addArrayOfBigDecimal(BigDecimal[] value)
      Add an array of BigDecimal value at the end of the tuple.
      Parameters:
      value - the value
      Returns:
      a reference to this, so the API can be used fluently
    • get

      default <T> T get(Class<T> type, int position)
      Get the the at the specified position and the specified type.

      The type can be one of the types returned by the row (e.g String.class) or an array of the type (e.g String[].class)).

      Parameters:
      type - the expected value type
      position - the value position
      Returns:
      the value if the value is found or null.
    • size

      int size()
      Returns:
      the tuple size
    • clear

      void clear()
    • types

      List<Class<?>> types()
      Returns:
      the list of types built from the tuple
    • deepToString

      default String deepToString()
      Returns:
      A String containing the Object.toString() value of each element, separated by a comma (,) character