Class FieldMaskUtil.MergeOptions

  • Enclosing class:
    FieldMaskUtil

    public static final class FieldMaskUtil.MergeOptions
    extends java.lang.Object
    Options to customize merging behavior.
    • Constructor Detail

      • MergeOptions

        public MergeOptions()
    • Method Detail

      • replaceMessageFields

        public boolean replaceMessageFields()
        Whether to replace message fields (i.e., discard existing content in destination message fields).
      • replaceRepeatedFields

        public boolean replaceRepeatedFields()
        Whether to replace repeated fields (i.e., discard existing content in destination repeated fields).
      • replacePrimitiveFields

        public boolean replacePrimitiveFields()
        Whether to replace primitive (non-repeated and non-message) fields in destination message fields with the source primitive fields (i.e., clear destination field if source field is not set).
      • setReplaceMessageFields

        @CanIgnoreReturnValue
        public FieldMaskUtil.MergeOptions setReplaceMessageFields​(boolean value)
        Specify whether to replace message fields. Defaults to false.

        If true, discard existing content in destination message fields when merging.

        If false, merge the source message field into the destination message field.

      • setReplaceRepeatedFields

        @CanIgnoreReturnValue
        public FieldMaskUtil.MergeOptions setReplaceRepeatedFields​(boolean value)
        Specify whether to replace repeated fields. Defaults to false.

        If true, discard existing content in destination repeated fields) when merging.

        If false, append elements from source repeated field to the destination repeated field.

      • setReplacePrimitiveFields

        @CanIgnoreReturnValue
        public FieldMaskUtil.MergeOptions setReplacePrimitiveFields​(boolean value)
        Specify whether to replace primitive (non-repeated and non-message) fields in destination message fields with the source primitive fields. Defaults to false.

        If true, set the value of the destination primitive field to the source primitive field if the source field is set, but clear the destination field otherwise.

        If false, always set the value of the destination primitive field to the source primitive field, and if the source field is unset, the default value of the source field is copied to the destination.