Package io.debezium.document
Class BasicDocument
java.lang.Object
io.debezium.document.BasicDocument
- All Implemented Interfaces:
Document
,Comparable<Document>
,Iterable<Document.Field>
Package-level implementation of
Document
.- Author:
- Randall Hauch
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.debezium.document.Document
Document.Field
-
Field Summary
Modifier and TypeFieldDescription(package private) static final Function<Map.Entry<? extends CharSequence,
Value>, Document.Field> private final Map<CharSequence,
Value> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Remove all fields from this document.clone()
Obtain a clone of this document.protected int
Semantically compare two values.protected int
compareNonNull
(Value value1, Value value2) Semantically compare two non-null values.int
Compare this Document to the specified Document, taking into account the order of the fields.int
Compare this Document to the specified Document, optionally comparing the fields in the same order.int
Compare this Document to the specified Document, without regard to the order of the fields and only using the fields that are in both documents.int
Compare this Document to the specified Document, without regard to the order of the fields.boolean
get
(CharSequence fieldName, Comparable<?> defaultValue) Gets the value in this document for the given field name.boolean
has
(CharSequence fieldName) Determine if this contains a field with the given name.boolean
Checks if this object contains all of the fields in the supplied document.int
hashCode()
increment
(CharSequence name, Value increment) Increment the numeric value in the given field by the designated amount.boolean
isEmpty()
Return whether this document contains no fields and is therefore empty.iterator()
keySet()
Returns this object's fields' namesputAll
(Iterable<Document.Field> object) Sets on this object all name/value pairs from the supplied object.remove
(CharSequence name) Remove the field with the supplied name, and return the value.Remove all fields from this document.setValue
(CharSequence name, Value value) Set the value for the field with the given name.int
size()
Return the number of name-value fields in this object.toString()
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.debezium.document.Document
children, children, find, find, forEach, get, getArray, getArray, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBytes, getDocument, getDouble, getDouble, getField, getFloat, getFloat, getInteger, getInteger, getLong, getLong, getNumber, getNumber, getOrCreateArray, getOrCreateDocument, getString, getString, increment, increment, increment, increment, isNull, isNullOrMissing, putAll, putAll, putAll, remove, set, set, setArray, setArray, setArray, setBinary, setBoolean, setDocument, setDocument, setNull, setNumber, setNumber, setNumber, setNumber, setNumber, setNumber, setString, setValue, stream, transform
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
CONVERT_ENTRY_TO_FIELD
static final Function<Map.Entry<? extends CharSequence,Value>, CONVERT_ENTRY_TO_FIELDDocument.Field> -
fields
-
-
Constructor Details
-
BasicDocument
BasicDocument()
-
-
Method Details
-
size
public int size()Description copied from interface:Document
Return the number of name-value fields in this object. -
isEmpty
public boolean isEmpty()Description copied from interface:Document
Return whether this document contains no fields and is therefore empty. -
compareTo
Description copied from interface:Document
Compare this Document to the specified Document, taking into account the order of the fields.- Specified by:
compareTo
in interfaceComparable<Document>
- Specified by:
compareTo
in interfaceDocument
- Parameters:
that
- the other Document to be compared to this object- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
compareToUsingSimilarFields
Description copied from interface:Document
Compare this Document to the specified Document, without regard to the order of the fields and only using the fields that are in both documents.- Specified by:
compareToUsingSimilarFields
in interfaceDocument
- Parameters:
that
- the other Document to be compared to this object- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
compareToWithoutFieldOrder
Description copied from interface:Document
Compare this Document to the specified Document, without regard to the order of the fields.- Specified by:
compareToWithoutFieldOrder
in interfaceDocument
- Parameters:
that
- the other Document to be compared to this object- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
compareTo
Description copied from interface:Document
Compare this Document to the specified Document, optionally comparing the fields in the same order.- Specified by:
compareTo
in interfaceDocument
- Parameters:
that
- the other Document to be compared to this objectenforceFieldOrder
-true
if the documents should be compared using their existing field order, orfalse
if the field order should not affect the result.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
compare
Semantically compare two values. This includes comparing numeric values of different types (e.g., an integer and long), andnull
andValue.nullValue()
references.- Parameters:
value1
- the first value; may be nullvalue2
- the second value; may be null- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
compareNonNull
Semantically compare two non-null values. This includes comparing numeric values of different types (e.g., an integer and long), but excludesnull
andValue.nullValue()
references.- Parameters:
value1
- the first value; may be nullvalue2
- the second value; may be null- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
keySet
Description copied from interface:Document
Returns this object's fields' names -
iterator
- Specified by:
iterator
in interfaceIterable<Document.Field>
-
clear
public void clear()Description copied from interface:Document
Remove all fields from this document. -
has
Description copied from interface:Document
Determine if this contains a field with the given name. -
hasAll
Description copied from interface:Document
Checks if this object contains all of the fields in the supplied document. -
get
Description copied from interface:Document
Gets the value in this document for the given field name. -
putAll
Description copied from interface:Document
Sets on this object all name/value pairs from the supplied object. If the supplied object is null, this method does nothing. -
removeAll
Description copied from interface:Document
Remove all fields from this document. -
remove
Description copied from interface:Document
Remove the field with the supplied name, and return the value. -
setValue
Description copied from interface:Document
Set the value for the field with the given name. -
increment
Description copied from interface:Document
Increment the numeric value in the given field by the designated amount. -
clone
Description copied from interface:Document
Obtain a clone of this document. -
hashCode
public int hashCode() -
equals
-
toString
-