Package io.confluent.ksql.api.client
Class KsqlArray
- java.lang.Object
-
- io.confluent.ksql.api.client.KsqlArray
-
public class KsqlArray extends Object
A representation of an array of values.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KsqlArrayadd(byte[] value)Appends the specified value to the end of the array.KsqlArrayadd(KsqlArray value)Appends the specified value to the end of the array.KsqlArrayadd(KsqlObject value)Appends the specified value to the end of the array.KsqlArrayadd(Boolean value)Appends the specified value to the end of the array.KsqlArrayadd(Double value)Appends the specified value to the end of the array.KsqlArrayadd(Integer value)Appends the specified value to the end of the array.KsqlArrayadd(Long value)Appends the specified value to the end of the array.KsqlArrayadd(Object value)Appends the specified value to the end of the array.KsqlArrayadd(String value)Appends the specified value to the end of the array.KsqlArrayadd(BigDecimal value)Appends the specified value to the end of the array.KsqlArrayaddAll(KsqlArray array)Appends the values in the specifiedKsqlArrayto the end of this instance.KsqlArrayaddNull()Appends a null value to the end of the array.KsqlArraycopy()Returns a copy of this.booleanequals(Object o)BooleangetBoolean(int pos)Returns the value at a specified index as a boolean.byte[]getBytes(int pos)Returns the value at a specified index as a byte array.BigDecimalgetDecimal(int pos)Returns the value at a specified index as aBigDecimal.DoublegetDouble(int pos)Returns the value at a specified index as a double.IntegergetInteger(int pos)Returns the value at a specified index as an integer.KsqlArraygetKsqlArray(int pos)Returns the value at a specified index as aKsqlArray.KsqlObjectgetKsqlObject(int pos)Returns the value at a specified index as aKsqlObject.List<?>getList()Returns values of the array as a list.LonggetLong(int pos)Returns the value at a specified index as a long.StringgetString(int pos)Returns the value at a specified index as a string.ObjectgetValue(int pos)Returns the value at a specified index as anObject.inthashCode()booleanisEmpty()Returns whether the array is empty.Iterator<Object>iterator()Returns an iterator over values of the array.Objectremove(int pos)Removes the value at a specified index from the array.booleanremove(Object value)Removes the first occurrence of the specified value from the array, if present.intsize()Returns the size (number of values) of the array.Stream<Object>stream()Returns values of the array as a stream.StringtoJsonString()Returns a JSON string representing the values in the array.StringtoString()Returns a JSON string representing the values in the array.
-
-
-
Constructor Detail
-
KsqlArray
public KsqlArray()
Creates an empty instance.
-
KsqlArray
public KsqlArray(List<?> list)
Creates an instance with the specified values.- Parameters:
list- the values
-
-
Method Detail
-
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
-
getValue
public Object getValue(int pos)
Returns the value at a specified index as anObject.- 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 stringIndexOutOfBoundsException- 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 aNumberIndexOutOfBoundsException- 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 aNumberIndexOutOfBoundsException- 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 aNumberIndexOutOfBoundsException- 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 booleanIndexOutOfBoundsException- if the index is invalid
-
getDecimal
public BigDecimal getDecimal(int pos)
Returns the value at a specified index as aBigDecimal.- Parameters:
pos- the index- Returns:
- the value
- Throws:
ClassCastException- if the value is not aNumberIndexOutOfBoundsException- 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 invalidIllegalArgumentException- if the array value is not a Base64 encoded string
-
getKsqlArray
public KsqlArray getKsqlArray(int pos)
Returns the value at a specified index as aKsqlArray.- Parameters:
pos- the index- Returns:
- the value
- Throws:
ClassCastException- if the value cannot be converted to a listIndexOutOfBoundsException- if the index is invalid
-
getKsqlObject
public KsqlObject getKsqlObject(int pos)
Returns the value at a specified index as aKsqlObject.- Parameters:
pos- the index- Returns:
- the value
- Throws:
ClassCastException- if the value cannot be converted to a mapIndexOutOfBoundsException- 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 specifiedKsqlArrayto 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 astoJsonString().
-
-