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
FieldsModifier and TypeFieldDescription(package private) static final Function<Map.Entry<? extends CharSequence,Value>, Document.Field> private final Map<CharSequence,Value> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Remove all fields from this document.clone()Obtain a clone of this document.protected intSemantically compare two values.protected intcompareNonNull(Value value1, Value value2) Semantically compare two non-null values.intCompare this Document to the specified Document, taking into account the order of the fields.intCompare this Document to the specified Document, optionally comparing the fields in the same order.intCompare this Document to the specified Document, without regard to the order of the fields and only using the fields that are in both documents.intCompare this Document to the specified Document, without regard to the order of the fields.booleanget(CharSequence fieldName, Comparable<?> defaultValue) Gets the value in this document for the given field name.booleanhas(CharSequence fieldName) Determine if this contains a field with the given name.booleanChecks if this object contains all of the fields in the supplied document.inthashCode()increment(CharSequence name, Value increment) Increment the numeric value in the given field by the designated amount.booleanisEmpty()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.intsize()Return the number of name-value fields in this object.toString()Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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, transformMethods 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:DocumentReturn the number of name-value fields in this object. -
isEmpty
public boolean isEmpty()Description copied from interface:DocumentReturn whether this document contains no fields and is therefore empty. -
compareTo
Description copied from interface:DocumentCompare this Document to the specified Document, taking into account the order of the fields.- Specified by:
compareToin interfaceComparable<Document>- Specified by:
compareToin 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:DocumentCompare 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:
compareToUsingSimilarFieldsin 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:DocumentCompare this Document to the specified Document, without regard to the order of the fields.- Specified by:
compareToWithoutFieldOrderin 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:DocumentCompare this Document to the specified Document, optionally comparing the fields in the same order.- Specified by:
compareToin interfaceDocument- Parameters:
that- the other Document to be compared to this objectenforceFieldOrder-trueif the documents should be compared using their existing field order, orfalseif 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), andnullandValue.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 excludesnullandValue.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:DocumentReturns this object's fields' names -
iterator
- Specified by:
iteratorin interfaceIterable<Document.Field>
-
clear
public void clear()Description copied from interface:DocumentRemove all fields from this document. -
has
Description copied from interface:DocumentDetermine if this contains a field with the given name. -
hasAll
Description copied from interface:DocumentChecks if this object contains all of the fields in the supplied document. -
get
Description copied from interface:DocumentGets the value in this document for the given field name. -
putAll
Description copied from interface:DocumentSets 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:DocumentRemove all fields from this document. -
remove
Description copied from interface:DocumentRemove the field with the supplied name, and return the value. -
setValue
Description copied from interface:DocumentSet the value for the field with the given name. -
increment
Description copied from interface:DocumentIncrement the numeric value in the given field by the designated amount. -
clone
Description copied from interface:DocumentObtain a clone of this document. -
hashCode
public int hashCode() -
equals
-
toString
-