Package com.hazelcast.jet.cdc
Interface RecordPart
Represents the top-level component of a 
ChangeRecord, such as
 the key or the value. Since these components are JSON
 expressions, this is actually a generic wrapper around a JSON expression.
 Contains various methods for retrieving component values or for mapping
 itself to data objects.- Since:
- Jet 4.2
- 
Method Summary
- 
Method Details- 
toObjectMaps the entire element to an instance of the specified class.Parsing is based on Jackson jr with annotation support, so the supplied class can be annotated accordingly. Note: there is a neat trick for converting types during object mapping. Let's say we have a birth_datecolumn in a table of typeDATEand we want to map it to a field namedbirthDatein our row object, of typeLocalDate. We would write code like this:
 The things to note here is that by specifying a setter and giving it the input parameter type ofpublic LocalDate birthDate; public void setBirthDate(long dateInEpochDays) { this.birthDate = dateInEpochDays == 0 ? null : LocalDate.ofEpochDay(dateInEpochDays); }longwe force the object mapping to interpret the column value as along(as opposed toDate). Then we can take care ofnullhandling and converting to whatever desired type ourselves.- Returns:
- object of type T, obtained as the result of the mapping
- Throws:
- ParsingException- if the mapping fails to produce a result
 
- 
toMapPresents a parsed form of the underlying JSON message as aMap. The keys are the top-level fields from the JSON and the values can range from simple strings, numbers, collections and sub-maps.Parsing is based on Jackson jr, you can refer to its documentation for more details. - Returns:
- Maprepresentation of the JSON data
- Throws:
- ParsingException- if the underlying JSON message fails to parse
 
- 
toJsonReturns the raw JSON string that this object wraps. You can use it if parsing is failing for some reason (for example on some untested DB-connector version combination).
 
-