Class UpdateBuilderImpl

    • Constructor Summary

      Constructors 
      Constructor Description
      UpdateBuilderImpl​(org.apache.avro.Schema updateSchema)  
    • Constructor Detail

      • UpdateBuilderImpl

        public UpdateBuilderImpl​(org.apache.avro.Schema updateSchema)
        Parameters:
        updateSchema - Update schema that is derived from the value Record schema.
    • 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 an IllegalStateException. 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 an IllegalStateException as well.
        Specified by:
        setNewFieldValue in interface UpdateBuilder
        Parameters:
        fieldName - field name
        newFieldValue - 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 an IllegalStateException. 2. Calling this method multiple times on the same list field, only last invocation takes effect.
        Specified by:
        setElementsToAddToListField in interface UpdateBuilder
        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 an IllegalStateException. 2. Calling this method multiple times on the same list field, only last invocation takes effect.
        Specified by:
        setElementsToRemoveFromListField in interface UpdateBuilder
        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 an IllegalStateException. 2. Calling this method multiple times on the same map field, only last invocation takes effect.
        Specified by:
        setEntriesToAddToMapField in interface UpdateBuilder
        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 an IllegalStateException. 2. Calling this method multiple times on the same map field, only last invocation takes effect.
        Specified by:
        setKeysToRemoveFromMapField in interface UpdateBuilder
        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 a GenericRecord that is ready to be sent as an Update request.
        Specified by:
        build in interface UpdateBuilder
        Returns:
        A GenericRecord that is ready to be sent to Venice.