Package io.debezium.document
Interface Array
- All Superinterfaces:
Comparable<Array>
,Iterable<Array.Entry>
- All Known Implementing Classes:
BasicArray
An array of
Value
s. The array can also be viewed as a stream of Array.Entry
instances, each of which contain the
index and the value.- Author:
- Randall Hauch
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault Array
add
(boolean value) Adds the boolean value to the end of this array.default Array
add
(double value) Adds the double value to the end of this array.default Array
add
(float value) Adds the float value to the end of this array.default Array
add
(int value) Adds the integer value to the end of this array.default Array
add
(long value) Adds the long value to the end of this array.default Array
Adds the array value to the end of this array.default Array
Adds the document value to the end of this array.Adds the value to the end of this array.default Array
Adds the boolean value to the end of this array.default Array
Adds the double value to the end of this array.default Array
Adds the float value to the end of this array.default Array
Adds the integer value to the end of this array.default Array
Adds the long value to the end of this array.default Array
Adds the string value to the end of this array.default Array
add
(BigDecimal value) Adds the decimal value to the end of this array.default Array
add
(BigInteger value) Adds the big integer value to the end of this array.default Array
Sets on this object all name/value pairs from the supplied object.default Array
Sets on this object all name/value pairs from the supplied object.default Array
Sets on this object all name/value pairs from the supplied object.default Array
Sets on this object all name/value pairs from the supplied object.default Array
addNull()
Adds a null value to the end of this array.clone()
Obtain a complete copy of this array.static Array
create()
static Array
static Array
static Array
static Array
static Array
static Array
createWithNulls
(int number) default Array
expand
(int desiredSize) If the current size of the array is smaller than the given size, expand it and use a null value for all new entries.default Array
expand
(int desiredSize, boolean value) If the current size of the array is smaller than the given size, expand it and use the supplied value for all new entries.default Array
expand
(int desiredSize, double value) If the current size of the array is smaller than the given size, expand it and use the supplied value for all new entries.default Array
expand
(int desiredSize, float value) If the current size of the array is smaller than the given size, expand it and use the supplied value for all new entries.default Array
expand
(int desiredSize, int value) If the current size of the array is smaller than the given size, expand it and use the supplied value for all new entries.default Array
expand
(int desiredSize, long value) If the current size of the array is smaller than the given size, expand it and use the supplied value for all new entries.If the current size of the array is smaller than the given size, expand it and use the supplied value for all new entries.default Array
If the current size of the array is smaller than the given size, expand it and use the supplied value for all new entries.get
(int index) Gets the value in this array at the given index.default Value
Gets the value in this document for the given field name.boolean
has
(int index) Determine if this contains an entry at the given index.default Array
increment
(int index, double increment) Increment the numeric value at the given location by the designated amount.default Array
increment
(int index, float increment) Increment the numeric value at the given location by the designated amount.default Array
increment
(int index, int increment) Increment the numeric value at the given location by the designated amount.default Array
increment
(int index, long increment) Increment the numeric value at the given location by the designated amount.Increment the numeric value at the given location by the designated amount.boolean
isEmpty()
Return whether this document contains no fields and is therefore empty.default boolean
isNull
(int index) Determine whether this object has an entry at the given index and the value is null.default boolean
isNullOrMissing
(int index) Determine whether this object has an entry at the given index and the value is null, or if this object has no entry at the given index.default Array
putAll
(Iterable<Array.Entry> entries) Sets on this object all key/value pairs from the supplied map.remove
(int index) Remove the specified entry from this arrayRemove all entries from this array.default Array
setArray
(int index) Set the value for the field with the given name to be a new, empty array.default Array
Set the value for the field with the given name to be the supplied array.default Array
Set the value for the field with the given name to be the supplied array.default Array
setBinary
(int index, byte[] data) Set the value for the field with the given name to be a binary value.default Array
setBoolean
(int index, boolean value) Set the value for the field with the given name to the supplied boolean value.default Document
setDocument
(int index) Set the value for the field with the given name to be a new, empty Document.default Document
setDocument
(int index, Document document) Set the value for the field with the given name to be the supplied Document.default Array
setNull
(int index) Set the value for the field with the given name to be a null value.default Array
setNumber
(int index, double value) Set the value for the field with the given name to the supplied double value.default Array
setNumber
(int index, float value) Set the value for the field with the given name to the supplied float value.default Array
setNumber
(int index, int value) Set the value for the field with the given name to the supplied integer value.default Array
setNumber
(int index, long value) Set the value for the field with the given name to the supplied long value.default Array
setNumber
(int index, BigDecimal value) Set the value for the field with the given name to the supplied big integer value.default Array
setNumber
(int index, BigInteger value) Set the value for the field with the given name to the supplied big integer value.default Array
Set the value for the field with the given name to the supplied string value.Set the value for the field with the given name to be a value.int
size()
Return the number of name-value fields in this object.default Stream<Array.Entry>
Returns a sequentialStream
with this array as its source.Returns a sequentialStream
with this array as its source.default Array
transform
(BiFunction<Integer, Value, Value> transformer) Transform all of the field values using the suppliedtransformer function
.values()
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
create
-
createWithNulls
-
create
-
create
-
create
-
create
-
create
-
size
int size()Return the number of name-value fields in this object.- Returns:
- the number of name-value fields; never negative
-
isEmpty
boolean isEmpty()Return whether this document contains no fields and is therefore empty.- Returns:
- true if there are no fields in this document, or false if there is at least one.
-
has
boolean has(int index) Determine if this contains an entry at the given index.- Parameters:
index
- the index- Returns:
- true if the entry exists, or false otherwise
-
get
Gets the value in this array at the given index.- Parameters:
index
- the index- Returns:
- The field value, if found, or null otherwise
-
get
Gets the value in this document for the given field name.- Parameters:
index
- the indexdefaultValue
- the default value to return if there is no such entry- Returns:
- The value if found or
defaultValue
if there is no such entry
-
isNull
default boolean isNull(int index) Determine whether this object has an entry at the given index and the value is null.- Parameters:
index
- the index- Returns:
true
if the entry exists but is null, or false otherwise- See Also:
-
isNullOrMissing
default boolean isNullOrMissing(int index) Determine whether this object has an entry at the given index and the value is null, or if this object has no entry at the given index.- Parameters:
index
- the index- Returns:
true
if the field value for the name is null or if there is no such field.- See Also:
-
remove
Remove the specified entry from this array- Parameters:
index
- the index- Returns:
- the value in the removed entry, or null if there is no such entry
-
removeAll
Array removeAll()Remove all entries from this array.- Returns:
- this array to allow for chaining methods
-
addAll
Sets on this object all name/value pairs from the supplied object. If the supplied object is null, this method does nothing.- Parameters:
values
- the values to be added to this array- Returns:
- this array to allow for chaining methods
-
addAll
Sets on this object all name/value pairs from the supplied object. If the supplied object is null, this method does nothing.- Parameters:
values
- the values to be added to this array- Returns:
- this array to allow for chaining methods
-
addAll
Sets on this object all name/value pairs from the supplied object. If the supplied object is null, this method does nothing.- Parameters:
values
- the values to be added to this array- Returns:
- this array to allow for chaining methods
-
addAll
Sets on this object all name/value pairs from the supplied object. If the supplied object is null, this method does nothing.- Parameters:
values
- the values to be added to this array- Returns:
- this array to allow for chaining methods
-
add
Adds the value to the end of this array.- Parameters:
value
- the value; may not be null- Returns:
- this array to allow for chaining methods
-
addNull
Adds a null value to the end of this array.- Returns:
- this array to allow for chaining methods
-
add
Adds the string value to the end of this array.- Parameters:
value
- the string value; may be null if anull value
should be added- Returns:
- this array to allow for chaining methods
-
add
Adds the boolean value to the end of this array.- Parameters:
value
- the boolean value; may not be null- Returns:
- this array to allow for chaining methods
-
add
Adds the boolean value to the end of this array.- Parameters:
value
- the boolean value; may be null if anull value
should be added- Returns:
- this array to allow for chaining methods
-
add
Adds the integer value to the end of this array.- Parameters:
value
- the integer value; may not be null- Returns:
- this array to allow for chaining methods
-
add
Adds the long value to the end of this array.- Parameters:
value
- the long value; may not be null- Returns:
- this array to allow for chaining methods
-
add
Adds the float value to the end of this array.- Parameters:
value
- the float value; may not be null- Returns:
- this array to allow for chaining methods
-
add
Adds the double value to the end of this array.- Parameters:
value
- the double value; may not be null- Returns:
- this array to allow for chaining methods
-
add
Adds the big integer value to the end of this array.- Parameters:
value
- the big integer value; may be null if anull value
should be added- Returns:
- this array to allow for chaining methods
-
add
Adds the decimal value to the end of this array.- Parameters:
value
- the decimal value; may be null if anull value
should be added- Returns:
- this array to allow for chaining methods
-
add
Adds the integer value to the end of this array.- Parameters:
value
- the integer value; may be null if anull value
should be added- Returns:
- this array to allow for chaining methods
-
add
Adds the long value to the end of this array.- Parameters:
value
- the long value; may be null if anull value
should be added- Returns:
- this array to allow for chaining methods
-
add
Adds the float value to the end of this array.- Parameters:
value
- the float value; may be null if anull value
should be added- Returns:
- this array to allow for chaining methods
-
add
Adds the double value to the end of this array.- Parameters:
value
- the double value; may be null if anull value
should be added- Returns:
- this array to allow for chaining methods
-
add
Adds the document value to the end of this array.- Parameters:
value
- the document value; may be null if anull value
should be added- Returns:
- this array to allow for chaining methods
-
add
Adds the array value to the end of this array.- Parameters:
value
- the array value; may be null if anull value
should be added- Returns:
- this array to allow for chaining methods
-
putAll
Sets on this object all key/value pairs from the supplied map. If the supplied map is null, this method does nothing.- Parameters:
entries
- the entries that are to be used to modify this array- Returns:
- this array to allow for chaining methods
-
values
-
streamEntries
Returns a sequentialStream
with this array as its source.- Returns:
- a sequential
Stream
over the elements in this collection
-
streamValues
Returns a sequentialStream
with this array as its source.- Returns:
- a sequential
Stream
over the elements in this collection
-
transform
Transform all of the field values using the suppliedtransformer function
.- Parameters:
transformer
- the transformer that should be used to transform each field value; may not be null- Returns:
- this array with transformed fields, or this document if the transformer changed none of the values
-
setNull
Set the value for the field with the given name to be a null value. TheisNull(int)
methods can be used to determine if a field has been set to null, orisNullOrMissing(int)
if the field has not be set or if it has been set to null.- Parameters:
index
- the index of the field; must be greater than or equal to 0 or less than or equal tosize
- Returns:
- this array to allow for chaining methods
- See Also:
-
setBoolean
Set the value for the field with the given name to the supplied boolean value.- Parameters:
index
- the index of the field; must be greater than or equal to 0 or less than or equal tosize
value
- the new value for the field- Returns:
- this array to allow for chaining methods
-
setNumber
Set the value for the field with the given name to the supplied integer value.- Parameters:
index
- the index of the field; must be greater than or equal to 0 or less than or equal tosize
value
- the new value for the field- Returns:
- this array to allow for chaining methods
-
setNumber
Set the value for the field with the given name to the supplied long value.- Parameters:
index
- the index of the field; must be greater than or equal to 0 or less than or equal tosize
value
- the new value for the field- Returns:
- this array to allow for chaining methods
-
setNumber
Set the value for the field with the given name to the supplied float value.- Parameters:
index
- the index of the field; must be greater than or equal to 0 or less than or equal tosize
value
- the new value for the field- Returns:
- this array to allow for chaining methods
-
setNumber
Set the value for the field with the given name to the supplied double value.- Parameters:
index
- the index of the field; must be greater than or equal to 0 or less than or equal tosize
value
- the new value for the field- Returns:
- this array to allow for chaining methods
-
setNumber
Set the value for the field with the given name to the supplied big integer value.- Parameters:
index
- the index of the field; must be greater than or equal to 0 or less than or equal tosize
value
- the new value for the field- Returns:
- this array to allow for chaining methods
-
setNumber
Set the value for the field with the given name to the supplied big integer value.- Parameters:
index
- the index of the field; must be greater than or equal to 0 or less than or equal tosize
value
- the new value for the field- Returns:
- this array to allow for chaining methods
-
setString
Set the value for the field with the given name to the supplied string value.- Parameters:
index
- the index of the field; must be greater than or equal to 0 or less than or equal tosize
value
- the new value for the field- Returns:
- this array to allow for chaining methods
-
setBinary
Set the value for the field with the given name to be a binary value. The value will be encoded as Base64.- Parameters:
index
- the index of the field; must be greater than or equal to 0 or less than or equal tosize
data
- the bytes for the binary value- Returns:
- this array to allow for chaining methods
-
setValue
Set the value for the field with the given name to be a value.- Parameters:
index
- the index of the field; must be greater than or equal to 0 and less than or equal tosize
value
- the new value- Returns:
- this array to allow for chaining methods
-
expand
If the current size of the array is smaller than the given size, expand it and use a null value for all new entries. This method does nothing if the current size is larger than the supplieddesiredSize
.- Parameters:
desiredSize
- the desired size of the array; may be negative- Returns:
- this array to allow for chaining methods
-
expand
If the current size of the array is smaller than the given size, expand it and use the supplied value for all new entries. This method does nothing if the current size is larger than the supplieddesiredSize
.- Parameters:
desiredSize
- the desired size of the array; may be negativevalue
- the new value for any new entries- Returns:
- this array to allow for chaining methods
-
expand
If the current size of the array is smaller than the given size, expand it and use the supplied value for all new entries. This method does nothing if the current size is larger than the supplieddesiredSize
.- Parameters:
desiredSize
- the desired size of the array; may be negativevalue
- the new value for any new entries- Returns:
- this array to allow for chaining methods
-
expand
If the current size of the array is smaller than the given size, expand it and use the supplied value for all new entries. This method does nothing if the current size is larger than the supplieddesiredSize
.- Parameters:
desiredSize
- the desired size of the array; may be negativevalue
- the new value for any new entries- Returns:
- this array to allow for chaining methods
-
expand
If the current size of the array is smaller than the given size, expand it and use the supplied value for all new entries. This method does nothing if the current size is larger than the supplieddesiredSize
.- Parameters:
desiredSize
- the desired size of the array; may be negativevalue
- the new value for any new entries- Returns:
- this array to allow for chaining methods
-
expand
If the current size of the array is smaller than the given size, expand it and use the supplied value for all new entries. This method does nothing if the current size is larger than the supplieddesiredSize
.- Parameters:
desiredSize
- the desired size of the array; may be negativevalue
- the new value for any new entries- Returns:
- this array to allow for chaining methods
-
expand
If the current size of the array is smaller than the given size, expand it and use the supplied value for all new entries. This method does nothing if the current size is larger than the supplieddesiredSize
.- Parameters:
desiredSize
- the desired size of the array; may be negativevalue
- the new value for any new entries- Returns:
- this array to allow for chaining methods
-
expand
If the current size of the array is smaller than the given size, expand it and use the supplied value for all new entries. This method does nothing if the current size is larger than the supplieddesiredSize
.- Parameters:
desiredSize
- the desired size of the array; may be negativevalue
- the new value for any new entries- Returns:
- this array to allow for chaining methods
-
increment
Increment the numeric value at the given location by the designated amount.- Parameters:
index
- the index of the field; must be greater than or equal to 0 and less than or equal tosize
increment
- the amount to increment the existing value; may be negative to decrement- Returns:
- this array to allow for chaining methods
- Throws:
IllegalArgumentException
- if the current value is not a number
-
increment
Increment the numeric value at the given location by the designated amount.- Parameters:
index
- the index of the field; must be greater than or equal to 0 and less than or equal tosize
increment
- the amount to increment the existing value; may be negative to decrement- Returns:
- this array to allow for chaining methods
- Throws:
IllegalArgumentException
- if the current value is not a number
-
increment
Increment the numeric value at the given location by the designated amount.- Parameters:
index
- the index of the field; must be greater than or equal to 0 and less than or equal tosize
increment
- the amount to increment the existing value; may be negative to decrement- Returns:
- this array to allow for chaining methods
- Throws:
IllegalArgumentException
- if the current value is not a number
-
increment
Increment the numeric value at the given location by the designated amount.- Parameters:
index
- the index of the field; must be greater than or equal to 0 and less than or equal tosize
increment
- the amount to increment the existing value; may be negative to decrement- Returns:
- this array to allow for chaining methods
- Throws:
IllegalArgumentException
- if the current value is not a number
-
increment
Increment the numeric value at the given location by the designated amount.- Parameters:
index
- the index of the field; must be greater than or equal to 0 and less than or equal tosize
increment
- the amount to increment the existing value; may be negative to decrement- Returns:
- this array to allow for chaining methods
- Throws:
IllegalArgumentException
- if the current value is not a number
-
setDocument
Set the value for the field with the given name to be a new, empty Document.- Parameters:
index
- the index of the field; must be greater than or equal to 0 and less than or equal tosize
- Returns:
- The editable document that was just created; never null
-
setDocument
Set the value for the field with the given name to be the supplied Document.- Parameters:
index
- the index of the field; must be greater than or equal to 0 or less than or equal tosize
document
- the document- Returns:
- The document that was just set as the value for the named field; never null and may or may not be the same
instance as the supplied
document
.
-
setArray
Set the value for the field with the given name to be a new, empty array.- Parameters:
index
- the index of the field; must be greater than or equal to 0 or less than or equal tosize
- Returns:
- The array that was just created; never null
-
setArray
Set the value for the field with the given name to be the supplied array.- Parameters:
index
- the index of the field; must be greater than or equal to 0 or less than or equal tosize
array
- the array- Returns:
- The array that was just set as the value for the named field; never null and may or may not be the same
instance as the supplied
array
.
-
setArray
Set the value for the field with the given name to be the supplied array.- Parameters:
index
- the index of the field; must be greater than or equal to 0 or less than or equal tosize
values
- the (valid) values for the array- Returns:
- The array that was just set as the value for the named field; never null and may or may not be the same
instance as the supplied
array
.
-
clone
Array clone()Obtain a complete copy of this array.- Returns:
- the clone of this array; never null
-