Class FieldMaskUtil.MergeOptions (3.19.4)

public static final class FieldMaskUtil.MergeOptions

Options to customize merging behavior.

Inheritance

java.lang.Object > FieldMaskUtil.MergeOptions

Constructors

MergeOptions()

public MergeOptions()

Methods

replaceMessageFields()

public boolean replaceMessageFields()

Whether to replace message fields (i.e., discard existing content in destination message fields).

Returns
TypeDescription
boolean

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).

Returns
TypeDescription
boolean

replaceRepeatedFields()

public boolean replaceRepeatedFields()

Whether to replace repeated fields (i.e., discard existing content in destination repeated fields).

Returns
TypeDescription
boolean

setReplaceMessageFields(boolean value)

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.

Parameter
NameDescription
valueboolean
Returns
TypeDescription
FieldMaskUtil.MergeOptions

setReplacePrimitiveFields(boolean value)

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.

Parameter
NameDescription
valueboolean
Returns
TypeDescription
FieldMaskUtil.MergeOptions

setReplaceRepeatedFields(boolean value)

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.

Parameter
NameDescription
valueboolean
Returns
TypeDescription
FieldMaskUtil.MergeOptions