Package io.confluent.ksql.api.client
Class KsqlObject
java.lang.Object
io.confluent.ksql.api.client.KsqlObject
A representation of a map of string keys to values. Useful for representing a JSON object.
-
Constructor Summary
ConstructorDescriptionCreates an empty instance.KsqlObject
(Map<String, Object> map) Creates an instance with the specified entries. -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(String key) Returns whether the map contains the specified key.copy()
Returns a copy of this.boolean
Returns the keys of the map.static KsqlObject
getBoolean
(String key) Returns the value associated with the specified key as a boolean.byte[]
Returns the value associated with the specified key as a byte array.getDecimal
(String key) Returns the value associated with the specified key as aBigDecimal
.Returns the value associated with the specified key as a double.getInteger
(String key) Returns the value associated with the specified key as an integer.getKsqlArray
(String key) Returns the value associated with the specified key as aKsqlArray
.getKsqlObject
(String key) Returns the value associated with the specified key as aKsqlObject
.Returns the value associated with the specified key as a long.getMap()
Returns the entries of the map as aMap
.Returns the value associated with the specified key as a string.Returns the value associated with the specified key as anObject
.int
hashCode()
boolean
isEmpty()
Returns whether the map is empty.iterator()
Returns an iterator over the entries of the map.mergeIn
(KsqlObject other) Adds entries from the specifiedKsqlObject
into this instance.Adds an entry for the specified key and value to the map.put
(String key, KsqlObject value) Adds an entry for the specified key and value to the map.Adds an entry for the specified key and value to the map.Adds an entry for the specified key and value to the map.Adds an entry for the specified key and value to the map.Adds an entry for the specified key and value to the map.Adds an entry for the specified key and value to the map.Adds an entry for the specified key and value to the map.put
(String key, BigDecimal value) Adds an entry for the specified key and value to the map.Adds an entry for the specified key with null value to the map.Removes the value associated with a specified key.int
size()
Returns the size (number of entries) of the map.stream()
Returns entries of the map as a stream.Returns a JSON string representing the entries in the map.toString()
Returns a JSON string representing the entries in the map.
-
Constructor Details
-
KsqlObject
public KsqlObject()Creates an empty instance. -
KsqlObject
Creates an instance with the specified entries.- Parameters:
map
- the entries
-
-
Method Details
-
containsKey
Returns whether the map contains the specified key.- Parameters:
key
- the key- Returns:
- whether the map contains the key
-
fieldNames
Returns the keys of the map.- Returns:
- the keys
-
size
public int size()Returns the size (number of entries) of the map.- Returns:
- the size
-
isEmpty
public boolean isEmpty()Returns whether the map is empty.- Returns:
- whether the map is empty
-
getMap
Returns the entries of the map as aMap
.- Returns:
- the entries
-
iterator
Returns an iterator over the entries of the map.- Returns:
- the iterator
-
stream
Returns entries of the map as a stream.- Returns:
- the stream
-
getValue
Returns the value associated with the specified key as anObject
. Returns null if the key is not present.- Parameters:
key
- the key- Returns:
- the value
-
getString
Returns the value associated with the specified key as a string. Returns null if the key is not present.- Parameters:
key
- the key- Returns:
- the value
- Throws:
ClassCastException
- if the value is not a string
-
getInteger
Returns the value associated with the specified key as an integer. Returns null if the key is not present.- Parameters:
key
- the key- Returns:
- the value
- Throws:
ClassCastException
- if the value is not aNumber
-
getLong
Returns the value associated with the specified key as a long. Returns null if the key is not present.- Parameters:
key
- the key- Returns:
- the value
- Throws:
ClassCastException
- if the value is not aNumber
-
getDouble
Returns the value associated with the specified key as a double. Returns null if the key is not present.- Parameters:
key
- the key- Returns:
- the value
- Throws:
ClassCastException
- if the value is not aNumber
-
getBoolean
Returns the value associated with the specified key as a boolean. Returns null if the key is not present.- Parameters:
key
- the key- Returns:
- the value
- Throws:
ClassCastException
- if the value is not a boolean
-
getDecimal
Returns the value associated with the specified key as aBigDecimal
. Returns null if the key is not present.- Parameters:
key
- the key- Returns:
- the value
- Throws:
ClassCastException
- if the value is not aNumber
-
getBytes
Returns the value associated with the specified key as a byte array. Returns null if the key is not present.- Parameters:
key
- the key- Returns:
- the value
- Throws:
ClassCastException
- if the value is not aString
IllegalArgumentException
- if the column value is not a base64 encoded string
-
getKsqlArray
Returns the value associated with the specified key as aKsqlArray
. Returns null if the key is not present.- Parameters:
key
- the key- Returns:
- the value
- Throws:
ClassCastException
- if the value cannot be converted to a list
-
getKsqlObject
Returns the value associated with the specified key as aKsqlObject
. Returns null if the key is not present.- Parameters:
key
- the key- Returns:
- the value
- Throws:
ClassCastException
- if the value cannot be converted to a map
-
remove
Removes the value associated with a specified key.- Parameters:
key
- the key- Returns:
- the removed value, or null if the key was not present
-
put
Adds an entry for the specified key and value to the map.- Parameters:
key
- the keyvalue
- the value- Returns:
- a reference to this
-
put
Adds an entry for the specified key and value to the map.- Parameters:
key
- the keyvalue
- the value- Returns:
- a reference to this
-
put
Adds an entry for the specified key and value to the map.- Parameters:
key
- the keyvalue
- the value- Returns:
- a reference to this
-
put
Adds an entry for the specified key and value to the map.- Parameters:
key
- the keyvalue
- the value- Returns:
- a reference to this
-
put
Adds an entry for the specified key and value to the map.- Parameters:
key
- the keyvalue
- the value- Returns:
- a reference to this
-
put
Adds an entry for the specified key and value to the map.- Parameters:
key
- the keyvalue
- the value- Returns:
- a reference to this
-
put
-
put
Adds an entry for the specified key and value to the map.- Parameters:
key
- the keyvalue
- the value- Returns:
- a reference to this
-
put
Adds an entry for the specified key and value to the map.- Parameters:
key
- the keyvalue
- the value- Returns:
- a reference to this
-
put
Adds an entry for the specified key and value to the map.- Parameters:
key
- the keyvalue
- the value- Returns:
- a reference to this
-
putNull
Adds an entry for the specified key with null value to the map.- Parameters:
key
- the key- Returns:
- a reference to this
-
mergeIn
Adds entries from the specifiedKsqlObject
into this instance.- Parameters:
other
- the entries to add- Returns:
- a reference to this
-
copy
Returns a copy of this.- Returns:
- the copy
-
toJsonString
Returns a JSON string representing the entries in the map.- Returns:
- the JSON string
-
toString
Returns a JSON string representing the entries in the map. Same astoJsonString()
. -
equals
-
hashCode
public int hashCode() -
fromArray
-