@@ -166,12 +166,12 @@ private class ObjectValueSerializer : JsonSerializer<ObjectValue>() {
166
166
* @property name Field name
167
167
* @property fieldCategory [FieldCategory] of the field
168
168
*/
169
- data class EnrichedAirbyteValue (
170
- val value : AirbyteValue ,
169
+ class EnrichedAirbyteValue (
170
+ var value : AirbyteValue ,
171
171
val type : AirbyteType ,
172
172
val name : String ,
173
173
val fieldCategory : FieldCategory ,
174
- val changes : List <Meta .Change > = emptyList ()
174
+ val changes : MutableList <Meta .Change > = mutableListOf ()
175
175
) {
176
176
init {
177
177
require(name.isNotBlank()) { " Field name cannot be blank" }
@@ -183,16 +183,16 @@ data class EnrichedAirbyteValue(
183
183
* @param reason The [Reason] for nullification, defaults to DESTINATION_SERIALIZATION_ERROR
184
184
* @return A new [EnrichedAirbyteValue] with a null value and an additional change record
185
185
*/
186
- fun toNullified (reason : Reason = Reason .DESTINATION_SERIALIZATION_ERROR ): EnrichedAirbyteValue {
186
+ fun nullify (reason : Reason = Reason .DESTINATION_SERIALIZATION_ERROR ) {
187
187
val nullChange =
188
188
Meta .Change (
189
189
field = name,
190
190
change = AirbyteRecordMessageMetaChange .Change .NULLED ,
191
191
reason = reason
192
192
)
193
193
194
- // Return a copy with null value and the new change added to the changes list
195
- return copy(value = NullValue , changes = changes + nullChange)
194
+ value = NullValue
195
+ changes.add( nullChange)
196
196
}
197
197
198
198
/* *
@@ -202,10 +202,10 @@ data class EnrichedAirbyteValue(
202
202
* @param newValue The new (truncated) value to use
203
203
* @return A new [EnrichedAirbyteValue] with the truncated value and an additional change record
204
204
*/
205
- fun toTruncated (
205
+ fun truncate (
206
206
reason : Reason = Reason .DESTINATION_RECORD_SIZE_LIMITATION ,
207
207
newValue : AirbyteValue
208
- ): EnrichedAirbyteValue {
208
+ ) {
209
209
val truncateChange =
210
210
Meta .Change (
211
211
field = name,
@@ -214,7 +214,8 @@ data class EnrichedAirbyteValue(
214
214
)
215
215
216
216
// Return a copy with null value and the new change added to the changes list
217
- return copy(value = newValue, changes = changes + truncateChange)
217
+ value = newValue
218
+ changes.add(truncateChange)
218
219
}
219
220
}
220
221
0 commit comments