public final class FieldMaskUtil
extends java.lang.Object
FieldMask
.Modifier and Type | Class and Description |
---|---|
static class |
FieldMaskUtil.MergeOptions
Options to customize merging behavior.
|
Modifier and Type | Method and Description |
---|---|
static FieldMask |
fromFieldNumbers(java.lang.Class<? extends Message> type,
int... fieldNumbers)
Constructs a FieldMask from the passed field numbers.
|
static FieldMask |
fromFieldNumbers(java.lang.Class<? extends Message> type,
java.lang.Iterable<java.lang.Integer> fieldNumbers)
Constructs a FieldMask from the passed field numbers.
|
static FieldMask |
fromJsonString(java.lang.String value)
Converts a field mask from a Proto3 JSON string, that is splitting the paths along commas and
converting from camel case to snake case.
|
static FieldMask |
fromString(java.lang.Class<? extends Message> type,
java.lang.String value)
Parses from a string to a FieldMask and validates all field paths.
|
static FieldMask |
fromString(java.lang.String value)
Parses from a string to a FieldMask.
|
static FieldMask |
fromStringList(java.lang.Class<? extends Message> type,
java.lang.Iterable<java.lang.String> paths)
Constructs a FieldMask for a list of field paths in a certain type.
|
static FieldMask |
fromStringList(Descriptors.Descriptor descriptor,
java.lang.Iterable<java.lang.String> paths)
Constructs a FieldMask for a list of field paths in a certain type.
|
static FieldMask |
fromStringList(java.lang.Iterable<java.lang.String> paths)
Constructs a FieldMask for a list of field paths in a certain type.
|
static FieldMask |
intersection(FieldMask mask1,
FieldMask mask2)
Calculates the intersection of two FieldMasks.
|
static boolean |
isValid(java.lang.Class<? extends Message> type,
FieldMask fieldMask)
Checks whether paths in a given fields mask are valid.
|
static boolean |
isValid(java.lang.Class<? extends Message> type,
java.lang.String path)
Checks whether a given field path is valid.
|
static boolean |
isValid(Descriptors.Descriptor descriptor,
FieldMask fieldMask)
Checks whether paths in a given fields mask are valid.
|
static boolean |
isValid(Descriptors.Descriptor descriptor,
java.lang.String path)
Checks whether paths in a given fields mask are valid.
|
static void |
merge(FieldMask mask,
Message source,
Message.Builder destination)
Merges fields specified by a FieldMask from one message to another.
|
static void |
merge(FieldMask mask,
Message source,
Message.Builder destination,
FieldMaskUtil.MergeOptions options)
Merges fields specified by a FieldMask from one message to another with the specified merge
options.
|
static FieldMask |
normalize(FieldMask mask)
Converts a FieldMask to its canonical form.
|
static FieldMask |
subtract(FieldMask firstMask,
FieldMask secondMask,
FieldMask... otherMasks)
Subtracts
secondMask and otherMasks from firstMask . |
static java.lang.String |
toJsonString(FieldMask fieldMask)
Converts a field mask to a Proto3 JSON string, that is converting from snake case to camel
case and joining all paths into one string with commas.
|
static java.lang.String |
toString(FieldMask fieldMask)
Converts a FieldMask to a string.
|
static FieldMask |
union(FieldMask firstMask,
FieldMask secondMask,
FieldMask... otherMasks)
Creates a union of two or more FieldMasks.
|
public static java.lang.String toString(FieldMask fieldMask)
public static FieldMask fromString(java.lang.String value)
public static FieldMask fromString(java.lang.Class<? extends Message> type, java.lang.String value)
java.lang.IllegalArgumentException
- if any of the field path is invalid.public static FieldMask fromStringList(java.lang.Class<? extends Message> type, java.lang.Iterable<java.lang.String> paths)
java.lang.IllegalArgumentException
- if any of the field path is not valid.public static FieldMask fromStringList(Descriptors.Descriptor descriptor, java.lang.Iterable<java.lang.String> paths)
java.lang.IllegalArgumentException
- if any of the field path is not valid.public static FieldMask fromStringList(java.lang.Iterable<java.lang.String> paths)
public static FieldMask fromFieldNumbers(java.lang.Class<? extends Message> type, int... fieldNumbers)
java.lang.IllegalArgumentException
- if any of the fields are invalid for the message.public static FieldMask fromFieldNumbers(java.lang.Class<? extends Message> type, java.lang.Iterable<java.lang.Integer> fieldNumbers)
java.lang.IllegalArgumentException
- if any of the fields are invalid for the message.public static java.lang.String toJsonString(FieldMask fieldMask)
public static FieldMask fromJsonString(java.lang.String value)
public static boolean isValid(java.lang.Class<? extends Message> type, FieldMask fieldMask)
public static boolean isValid(Descriptors.Descriptor descriptor, FieldMask fieldMask)
public static boolean isValid(java.lang.Class<? extends Message> type, java.lang.String path)
public static boolean isValid(Descriptors.Descriptor descriptor, java.lang.String path)
public static FieldMask normalize(FieldMask mask)
public static FieldMask union(FieldMask firstMask, FieldMask secondMask, FieldMask... otherMasks)
public static FieldMask subtract(FieldMask firstMask, FieldMask secondMask, FieldMask... otherMasks)
secondMask
and otherMasks
from firstMask
.
This method disregards proto structure. That is, if firstMask
is "foo" and secondMask
is "foo.bar", the response will always be "foo" without considering the internal
proto structure of message "foo".
public static FieldMask intersection(FieldMask mask1, FieldMask mask2)
public static void merge(FieldMask mask, Message source, Message.Builder destination, FieldMaskUtil.MergeOptions options)
public static void merge(FieldMask mask, Message source, Message.Builder destination)