Class UpdateBuilderImpl
- java.lang.Object
-
- com.linkedin.venice.writer.update.UpdateBuilderImpl
-
- All Implemented Interfaces:
UpdateBuilder
@Experimental public class UpdateBuilderImpl extends java.lang.Object implements UpdateBuilder
-
-
Constructor Summary
Constructors Constructor Description UpdateBuilderImpl(org.apache.avro.Schema updateSchema)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.avro.generic.GenericRecord
build()
Build aGenericRecord
that is ready to be sent as an Update request.UpdateBuilder
setElementsToAddToListField(java.lang.String listFieldName, java.util.List<?> elementsToAdd)
Set elements to be added to a List/Array field.UpdateBuilder
setElementsToRemoveFromListField(java.lang.String listFieldName, java.util.List<?> elementsToRemove)
Set elements to be removed from a List/Array field.UpdateBuilder
setEntriesToAddToMapField(java.lang.String mapFieldName, java.util.Map<java.lang.String,?> entriesToAdd)
Set k-v entries to be added to a Map field.UpdateBuilder
setKeysToRemoveFromMapField(java.lang.String mapFieldName, java.util.List<java.lang.String> keysToRemove)
Set keys to be added to a Map field.UpdateBuilder
setNewFieldValue(java.lang.String fieldName, java.lang.Object newFieldValue)
Set a new value to a field.
-
-
-
Method Detail
-
setNewFieldValue
public UpdateBuilder setNewFieldValue(java.lang.String fieldName, java.lang.Object newFieldValue)
Description copied from interface:UpdateBuilder
Set 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 anIllegalStateException
as well.- Specified by:
setNewFieldValue
in interfaceUpdateBuilder
- Parameters:
fieldName
- field namenewFieldValue
- new value that is going to be set to this field.
-
setElementsToAddToListField
public UpdateBuilder setElementsToAddToListField(java.lang.String listFieldName, java.util.List<?> elementsToAdd)
Description copied from interface:UpdateBuilder
Set 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:
setElementsToAddToListField
in interfaceUpdateBuilder
- Parameters:
listFieldName
- name of a list field.elementsToAdd
- Elements that are going to be added to this list field.
-
setElementsToRemoveFromListField
public UpdateBuilder setElementsToRemoveFromListField(java.lang.String listFieldName, java.util.List<?> elementsToRemove)
Description copied from interface:UpdateBuilder
Set 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:
setElementsToRemoveFromListField
in interfaceUpdateBuilder
- Parameters:
listFieldName
- Name of a list field.elementsToRemove
- Elements that are going to be removed from this list field.
-
setEntriesToAddToMapField
public UpdateBuilder setEntriesToAddToMapField(java.lang.String mapFieldName, java.util.Map<java.lang.String,?> entriesToAdd)
Description copied from interface:UpdateBuilder
Set 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:
setEntriesToAddToMapField
in interfaceUpdateBuilder
- Parameters:
mapFieldName
- Name of a map field.entriesToAdd
- Entries that are going to be added to this map field.
-
setKeysToRemoveFromMapField
public UpdateBuilder setKeysToRemoveFromMapField(java.lang.String mapFieldName, java.util.List<java.lang.String> keysToRemove)
Description copied from interface:UpdateBuilder
Set 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:
setKeysToRemoveFromMapField
in 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:UpdateBuilder
Build aGenericRecord
that is ready to be sent as an Update request.- Specified by:
build
in interfaceUpdateBuilder
- Returns:
- A
GenericRecord
that is ready to be sent to Venice.
-
-