Class KsqlArray

java.lang.Object
io.confluent.ksql.api.client.KsqlArray

public class KsqlArray extends Object
A representation of an array of values.
  • Constructor Details

    • KsqlArray

      public KsqlArray()
      Creates an empty instance.
    • KsqlArray

      public KsqlArray(List<?> list)
      Creates an instance with the specified values.
      Parameters:
      list - the values
  • Method Details

    • size

      public int size()
      Returns the size (number of values) of the array.
      Returns:
      the size
    • isEmpty

      public boolean isEmpty()
      Returns whether the array is empty.
      Returns:
      whether the array is empty
    • getList

      public List<?> getList()
      Returns values of the array as a list.
      Returns:
      list of values
    • iterator

      public Iterator<Object> iterator()
      Returns an iterator over values of the array.
      Returns:
      the iterator
    • stream

      public Stream<Object> stream()
      Returns values of the array as a stream.
      Returns:
      the stream
    • getValue

      public Object getValue(int pos)
      Returns the value at a specified index as an Object.
      Parameters:
      pos - the index
      Returns:
      the value
    • getString

      public String getString(int pos)
      Returns the value at a specified index as a string.
      Parameters:
      pos - the index
      Returns:
      the value
      Throws:
      ClassCastException - if the value is not a string
      IndexOutOfBoundsException - if the index is invalid
    • getInteger

      public Integer getInteger(int pos)
      Returns the value at a specified index as an integer.
      Parameters:
      pos - the index
      Returns:
      the value
      Throws:
      ClassCastException - if the value is not a Number
      IndexOutOfBoundsException - if the index is invalid
    • getLong

      public Long getLong(int pos)
      Returns the value at a specified index as a long.
      Parameters:
      pos - the index
      Returns:
      the value
      Throws:
      ClassCastException - if the value is not a Number
      IndexOutOfBoundsException - if the index is invalid
    • getDouble

      public Double getDouble(int pos)
      Returns the value at a specified index as a double.
      Parameters:
      pos - the index
      Returns:
      the value
      Throws:
      ClassCastException - if the value is not a Number
      IndexOutOfBoundsException - if the index is invalid
    • getBoolean

      public Boolean getBoolean(int pos)
      Returns the value at a specified index as a boolean.
      Parameters:
      pos - the index
      Returns:
      the value
      Throws:
      ClassCastException - if the value is not a boolean
      IndexOutOfBoundsException - if the index is invalid
    • getDecimal

      public BigDecimal getDecimal(int pos)
      Returns the value at a specified index as a BigDecimal.
      Parameters:
      pos - the index
      Returns:
      the value
      Throws:
      ClassCastException - if the value is not a Number
      IndexOutOfBoundsException - if the index is invalid
    • getBytes

      public byte[] getBytes(int pos)
      Returns the value at a specified index as a byte array.
      Parameters:
      pos - the index
      Returns:
      the value
      Throws:
      IndexOutOfBoundsException - if the index is invalid
      IllegalArgumentException - if the array value is not a Base64 encoded string
    • getKsqlArray

      public KsqlArray getKsqlArray(int pos)
      Returns the value at a specified index as a KsqlArray.
      Parameters:
      pos - the index
      Returns:
      the value
      Throws:
      ClassCastException - if the value cannot be converted to a list
      IndexOutOfBoundsException - if the index is invalid
    • getKsqlObject

      public KsqlObject getKsqlObject(int pos)
      Returns the value at a specified index as a KsqlObject.
      Parameters:
      pos - the index
      Returns:
      the value
      Throws:
      ClassCastException - if the value cannot be converted to a map
      IndexOutOfBoundsException - if the index is invalid
    • remove

      public Object remove(int pos)
      Removes the value at a specified index from the array.
      Parameters:
      pos - the index
      Returns:
      the removed value
      Throws:
      IndexOutOfBoundsException - if the index is invalid
    • remove

      public boolean remove(Object value)
      Removes the first occurrence of the specified value from the array, if present.
      Parameters:
      value - the value to remove
      Returns:
      whether the value was removed
    • add

      public KsqlArray add(String value)
      Appends the specified value to the end of the array.
      Parameters:
      value - the value to append
      Returns:
      a reference to this
    • add

      public KsqlArray add(Integer value)
      Appends the specified value to the end of the array.
      Parameters:
      value - the value to append
      Returns:
      a reference to this
    • add

      public KsqlArray add(Long value)
      Appends the specified value to the end of the array.
      Parameters:
      value - the value to append
      Returns:
      a reference to this
    • add

      public KsqlArray add(Double value)
      Appends the specified value to the end of the array.
      Parameters:
      value - the value to append
      Returns:
      a reference to this
    • add

      public KsqlArray add(Boolean value)
      Appends the specified value to the end of the array.
      Parameters:
      value - the value to append
      Returns:
      a reference to this
    • add

      public KsqlArray add(BigDecimal value)
      Appends the specified value to the end of the array.
      Parameters:
      value - the value to append
      Returns:
      a reference to this
    • add

      public KsqlArray add(byte[] value)
      Appends the specified value to the end of the array.
      Parameters:
      value - the value to append
      Returns:
      a reference to this
    • add

      public KsqlArray add(KsqlArray value)
      Appends the specified value to the end of the array.
      Parameters:
      value - the value to append
      Returns:
      a reference to this
    • add

      public KsqlArray add(KsqlObject value)
      Appends the specified value to the end of the array.
      Parameters:
      value - the value to append
      Returns:
      a reference to this
    • add

      public KsqlArray add(Object value)
      Appends the specified value to the end of the array.
      Parameters:
      value - the value to append
      Returns:
      a reference to this
    • addNull

      public KsqlArray addNull()
      Appends a null value to the end of the array.
      Returns:
      a reference to this
    • addAll

      public KsqlArray addAll(KsqlArray array)
      Appends the values in the specified KsqlArray to the end of this instance.
      Parameters:
      array - the values to append
      Returns:
      a reference to this
    • copy

      public KsqlArray copy()
      Returns a copy of this.
      Returns:
      the copy
    • toJsonString

      public String toJsonString()
      Returns a JSON string representing the values in the array.
      Returns:
      the JSON string
    • toString

      public String toString()
      Returns a JSON string representing the values in the array. Same as toJsonString().
      Overrides:
      toString in class Object
      Returns:
      the JSON string
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object