Package io.debezium.document
Interface Value
- All Superinterfaces:
Comparable<Value>
- All Known Implementing Classes:
BinaryValue,ComparableValue,ConvertingValue,NullValue
A value in a
Document or Array. Note that compareTo(io.debezium.document.Value, io.debezium.document.Value) might perform literal comparisons;
to perform semantic comparisons, use comparable() to obtain a wrapped value with semantic comparison capability.- Author:
- Randall Hauch
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionasArray()byte[]asBytes()asDouble()asFloat()asLong()asNumber()asObject()Get the raw value.asString()clone()Obtain a clone of this value.default ValueGet a Value representation that will allow semantic comparison of values, rather than the literal comparison normally performed bycompareTo(io.debezium.document.Value, io.debezium.document.Value).static intCompare twoValueobjects, which may or may not be null.convert()Get a Value representation that will convert attempt to convert values.static Valuecreate(boolean value) static Valuecreate(byte[] value) static Valuecreate(double value) static Valuecreate(float value) static Valuecreate(int value) static Valuecreate(long value) static Valuestatic Valuestatic Valuestatic Valuestatic Valuestatic Valuestatic Valuestatic Valuestatic Valuecreate(BigDecimal value) static Valuecreate(BigInteger value) default Value.TypegetType()default booleanIf a value is an array, invoke the specified consumer with the value, otherwise do nothing.default booleanifBigDecimal(Consumer<BigDecimal> consumer) If a value is a variable-sized decimal, invoke the specified consumer with the value, otherwise do nothing.default booleanifBigInteger(Consumer<BigInteger> consumer) If a value is a variable-sized integer, invoke the specified consumer with the value, otherwise do nothing.default booleanIf a value is a byte array, invoke the specified consumer with the value, otherwise do nothing.default booleanIf a value is a boolean value, invoke the specified consumer with the value, otherwise do nothing.default booleanifDocument(Consumer<Document> consumer) If a value is a document, invoke the specified consumer with the value, otherwise do nothing.default booleanifDouble(DoubleConsumer consumer) If a value is a double, invoke the specified consumer with the value, otherwise do nothing.default booleanifFloat(DoubleConsumer consumer) If a value is a float, invoke the specified consumer with the value, otherwise do nothing.default booleanifInteger(IntConsumer consumer) If a value is an integer, invoke the specified consumer with the value, otherwise do nothing.default booleanifLong(LongConsumer consumer) If a value is a long, invoke the specified consumer with the value, otherwise do nothing.default booleanifNull(Value.NullHandler consumer) If a value is a variable-sized integer, invoke the specified consumer with the value, otherwise do nothing.default booleanIf a value is a string, invoke the specified consumer with the value, otherwise do nothing.booleanisArray()booleanbooleanbooleanisBinary()booleanbooleanbooleanisDouble()booleanisFloat()booleanbooleanisLong()default booleanbooleanisNull()static booleanbooleanisNumber()booleanisString()static booleanstatic booleanstatic ValueMethods inherited from interface java.lang.Comparable
compareTo
-
Method Details
-
isNull
-
notNull
-
isValid
-
compareTo
Compare twoValueobjects, which may or may not be null.- Parameters:
value1- the first value object, may be nullvalue2- the second value object, which may be null- Returns:
- a negative integer if the first value is less than the second, zero if the values are equivalent (including if both are null), or a positive integer if the first value is greater than the second
-
create
-
create
-
create
-
create
-
create
-
create
-
create
-
create
-
create
-
create
-
create
-
create
-
create
-
create
-
create
-
create
-
nullValue
-
getType
-
asObject
Object asObject()Get the raw value.- Returns:
- the raw value; may be null
-
asString
String asString() -
asInteger
Integer asInteger() -
asLong
Long asLong() -
asBoolean
Boolean asBoolean() -
asNumber
Number asNumber() -
asBigInteger
BigInteger asBigInteger() -
asBigDecimal
BigDecimal asBigDecimal() -
asFloat
Float asFloat() -
asDouble
Double asDouble() -
asDocument
Document asDocument() -
asArray
Array asArray() -
asBytes
byte[] asBytes() -
isNull
boolean isNull() -
isNotNull
default boolean isNotNull() -
isString
boolean isString() -
isInteger
boolean isInteger() -
isLong
boolean isLong() -
isBoolean
boolean isBoolean() -
isNumber
boolean isNumber() -
isBigInteger
boolean isBigInteger() -
isBigDecimal
boolean isBigDecimal() -
isFloat
boolean isFloat() -
isDouble
boolean isDouble() -
isDocument
boolean isDocument() -
isArray
boolean isArray() -
isBinary
boolean isBinary() -
convert
Value convert()Get a Value representation that will convert attempt to convert values.- Returns:
- a value that can convert actual values to the requested format
-
comparable
Get a Value representation that will allow semantic comparison of values, rather than the literal comparison normally performed bycompareTo(io.debezium.document.Value, io.debezium.document.Value).- Returns:
- the Value that will perform semantic comparisons; never null
-
clone
Value clone()Obtain a clone of this value.- Returns:
- the clone of this value; never null, but possibly the same instance if the underlying value is immutable and not a document or array
-
ifDocument
If a value is a document, invoke the specified consumer with the value, otherwise do nothing.- Parameters:
consumer- block to be executed if the value is a document- Returns:
- true if the block was called, or false otherwise
-
ifArray
If a value is an array, invoke the specified consumer with the value, otherwise do nothing.- Parameters:
consumer- block to be executed if the value is an array- Returns:
- true if the block was called, or false otherwise
-
ifString
If a value is a string, invoke the specified consumer with the value, otherwise do nothing.- Parameters:
consumer- block to be executed if the value is a string- Returns:
- true if the block was called, or false otherwise
-
ifBoolean
If a value is a boolean value, invoke the specified consumer with the value, otherwise do nothing.- Parameters:
consumer- block to be executed if the value is a boolean- Returns:
- true if the block was called, or false otherwise
-
ifBinary
If a value is a byte array, invoke the specified consumer with the value, otherwise do nothing.- Parameters:
consumer- block to be executed if the value is a byte array- Returns:
- true if the block was called, or false otherwise
-
ifInteger
If a value is an integer, invoke the specified consumer with the value, otherwise do nothing.- Parameters:
consumer- block to be executed if the value is an integer- Returns:
- true if the block was called, or false otherwise
-
ifLong
If a value is a long, invoke the specified consumer with the value, otherwise do nothing.- Parameters:
consumer- block to be executed if the value is a long- Returns:
- true if the block was called, or false otherwise
-
ifFloat
If a value is a float, invoke the specified consumer with the value, otherwise do nothing.- Parameters:
consumer- block to be executed if the value is a float- Returns:
- true if the block was called, or false otherwise
-
ifDouble
If a value is a double, invoke the specified consumer with the value, otherwise do nothing.- Parameters:
consumer- block to be executed if the value is a double- Returns:
- true if the block was called, or false otherwise
-
ifBigInteger
If a value is a variable-sized integer, invoke the specified consumer with the value, otherwise do nothing.- Parameters:
consumer- block to be executed if the value is a big integer- Returns:
- true if the block was called, or false otherwise
-
ifBigDecimal
If a value is a variable-sized decimal, invoke the specified consumer with the value, otherwise do nothing.- Parameters:
consumer- block to be executed if the value is a big decimal- Returns:
- true if the block was called, or false otherwise
-
ifNull
If a value is a variable-sized integer, invoke the specified consumer with the value, otherwise do nothing.- Parameters:
consumer- block to be executed if the value is a big integer- Returns:
- true if the block was called, or false otherwise
-