Class UpdateBuilderImpl
java.lang.Object
com.linkedin.venice.writer.update.UpdateBuilderImpl
- All Implemented Interfaces:
UpdateBuilder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.avro.generic.GenericRecordbuild()Build aGenericRecordthat is ready to be sent as an Update request.setElementsToAddToListField(String listFieldName, List<?> elementsToAdd) Set elements to be added to a List/Array field.setElementsToRemoveFromListField(String listFieldName, List<?> elementsToRemove) Set elements to be removed from a List/Array field.setEntriesToAddToMapField(String mapFieldName, Map<String, ?> entriesToAdd) Set k-v entries to be added to a Map field.setKeysToRemoveFromMapField(String mapFieldName, List<String> keysToRemove) Set keys to be added to a Map field.setNewFieldValue(String fieldName, Object newFieldValue) Set a new value to a field.
-
Constructor Details
-
UpdateBuilderImpl
public UpdateBuilderImpl(org.apache.avro.Schema updateSchema) - Parameters:
updateSchema- Update schema that is derived from the value Record schema.
-
-
Method Details
-
setNewFieldValue
Description copied from interface:UpdateBuilderSet a new value to a field. Note that setting value on the same field multiple times throws anIllegalStateException. If this field is a List/Map field and other methods are used to add to or remove from this field, calling this method throws anIllegalStateExceptionas well.- Specified by:
setNewFieldValuein interfaceUpdateBuilder- Parameters:
fieldName- field namenewFieldValue- new value that is going to be set to this field.
-
setElementsToAddToListField
Description copied from interface:UpdateBuilderSet elements to be added to a List/Array field. Note that: 1. If a list field has already set new list value by invoking {@link this#setNewFieldValue}, calling this method on the same list field should throw anIllegalStateException. 2. Calling this method multiple times on the same list field, only last invocation takes effect.- Specified by:
setElementsToAddToListFieldin interfaceUpdateBuilder- Parameters:
listFieldName- name of a list field.elementsToAdd- Elements that are going to be added to this list field.
-
setElementsToRemoveFromListField
public UpdateBuilder setElementsToRemoveFromListField(String listFieldName, List<?> elementsToRemove) Description copied from interface:UpdateBuilderSet elements to be removed from a List/Array field. Note that: 1. If a list field has already set new list value by invoking {@link this#setNewFieldValue}, calling this method on the same list field should throw anIllegalStateException. 2. Calling this method multiple times on the same list field, only last invocation takes effect.- Specified by:
setElementsToRemoveFromListFieldin interfaceUpdateBuilder- Parameters:
listFieldName- Name of a list field.elementsToRemove- Elements that are going to be removed from this list field.
-
setEntriesToAddToMapField
Description copied from interface:UpdateBuilderSet k-v entries to be added to a Map field. Note that: 1. If a map field has already set new list value by invoking {@link this#setNewFieldValue}, calling this method on the same map field should throw anIllegalStateException. 2. Calling this method multiple times on the same map field, only last invocation takes effect.- Specified by:
setEntriesToAddToMapFieldin interfaceUpdateBuilder- Parameters:
mapFieldName- Name of a map field.entriesToAdd- Entries that are going to be added to this map field.
-
setKeysToRemoveFromMapField
Description copied from interface:UpdateBuilderSet keys to be added to a Map field. Note that: 1. If a map field has already set new list value by invoking {@link this#setNewFieldValue}, calling this method on the same map field should throw anIllegalStateException. 2. Calling this method multiple times on the same map field, only last invocation takes effect.- Specified by:
setKeysToRemoveFromMapFieldin interfaceUpdateBuilder- Parameters:
mapFieldName- Name of a map field.keysToRemove- Keys of k-v entries that are going to be removed from this map field.
-
build
public org.apache.avro.generic.GenericRecord build()Description copied from interface:UpdateBuilderBuild aGenericRecordthat is ready to be sent as an Update request.- Specified by:
buildin interfaceUpdateBuilder- Returns:
- A
GenericRecordthat is ready to be sent to Venice.
-