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 KsqlArray
add(KsqlArray value)
Appends the specified value to the end of the array.KsqlArray
add(KsqlObject value)
Appends the specified value to the end of the array.KsqlArray
add(Boolean value)
Appends the specified value to the end of the array.KsqlArray
add(Double value)
Appends the specified value to the end of the array.KsqlArray
add(Integer value)
Appends the specified value to the end of the array.KsqlArray
add(Long value)
Appends the specified value to the end of the array.KsqlArray
add(Object value)
Appends the specified value to the end of the array.KsqlArray
add(String value)
Appends the specified value to the end of the array.KsqlArray
add(BigDecimal value)
Appends the specified value to the end of the array.KsqlArray
addAll(KsqlArray array)
Appends the values in the specifiedKsqlArray
to the end of this instance.KsqlArray
addNull()
Appends a null value to the end of the array.KsqlArray
copy()
Returns a copy of this.boolean
equals(Object o)
Boolean
getBoolean(int pos)
Returns the value at a specified index as a boolean.BigDecimal
getDecimal(int pos)
Returns the value at a specified index as aBigDecimal
.Double
getDouble(int pos)
Returns the value at a specified index as a double.Integer
getInteger(int pos)
Returns the value at a specified index as an integer.KsqlArray
getKsqlArray(int pos)
Returns the value at a specified index as aKsqlArray
.KsqlObject
getKsqlObject(int pos)
Returns the value at a specified index as aKsqlObject
.List<?>
getList()
Returns values of the array as a list.Long
getLong(int pos)
Returns the value at a specified index as a long.String
getString(int pos)
Returns the value at a specified index as a string.Object
getValue(int pos)
Returns the value at a specified index as anObject
.int
hashCode()
boolean
isEmpty()
Returns whether the array is empty.Iterator<Object>
iterator()
Returns an iterator over values of the array.Object
remove(int pos)
Removes the value at a specified index from the array.boolean
remove(Object value)
Removes the first occurrence of the specified value from the array, if present.int
size()
Returns the size (number of values) of the array.Stream<Object>
stream()
Returns values of the array as a stream.String
toJsonString()
Returns a JSON string representing the values in the array.String
toString()
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 aNumber
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 aNumber
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 aNumber
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 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 aNumber
IndexOutOfBoundsException
- if the index is invalid
-
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(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 specifiedKsqlArray
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 astoJsonString()
.
-
-