Class FieldMaskUtil (3.19.4)

  public 
  
 final 
  
 class 
 FieldMaskUtil 
 

Utility helper functions to work with com.google.protobuf.FieldMask .

Inheritance

java.lang.Object > FieldMaskUtil

Static Methods

<P>trim(FieldMask mask, P source)

  public 
  
 static 
  
 P 
  
< P>trim 
 ( 
 FieldMask 
  
 mask 
 , 
  
 P 
  
 source 
 ) 
 

Returns the result of keeping only the masked fields of the given proto.

Parameters
Name
Description
mask
source
P
Returns
Type
Description
P

fromFieldNumbers(Class<? extends Message> type, int[] fieldNumbers)

  public 
  
 static 
  
 FieldMask 
  
 fromFieldNumbers 
 ( 
 Class 
< ? 
  
 extends 
  
 Message 
>  
 type 
 , 
  
 int 
 [] 
  
 fieldNumbers 
 ) 
 

Constructs a FieldMask from the passed field numbers.

Parameters
Name
Description
type
Class < ? extends com.google.protobuf.Message >
fieldNumbers
int []
Returns
Type
Description

fromFieldNumbers(Class<? extends Message> type, Iterable<Integer> fieldNumbers)

  public 
  
 static 
  
 FieldMask 
  
 fromFieldNumbers 
 ( 
 Class 
< ? 
  
 extends 
  
 Message 
>  
 type 
 , 
  
 Iterable<Integer> 
  
 fieldNumbers 
 ) 
 

Constructs a FieldMask from the passed field numbers.

Parameters
Name
Description
type
Class < ? extends com.google.protobuf.Message >
fieldNumbers
Returns
Type
Description

fromJsonString(String value)

  public 
  
 static 
  
 FieldMask 
  
 fromJsonString 
 ( 
 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.

Parameter
Name
Description
value
Returns
Type
Description

fromString(Class<? extends Message> type, String value)

  public 
  
 static 
  
 FieldMask 
  
 fromString 
 ( 
 Class 
< ? 
  
 extends 
  
 Message 
>  
 type 
 , 
  
 String 
  
 value 
 ) 
 

Parses from a string to a FieldMask and validates all field paths.

Parameters
Name
Description
type
Class < ? extends com.google.protobuf.Message >
value
Returns
Type
Description

fromString(String value)

  public 
  
 static 
  
 FieldMask 
  
 fromString 
 ( 
 String 
  
 value 
 ) 
 

Parses from a string to a FieldMask.

Parameter
Name
Description
value
Returns
Type
Description

fromStringList(Descriptors.Descriptor descriptor, Iterable<String> paths)

  public 
  
 static 
  
 FieldMask 
  
 fromStringList 
 ( 
 Descriptors 
 . 
 Descriptor 
  
 descriptor 
 , 
  
 Iterable<String> 
  
 paths 
 ) 
 

Constructs a FieldMask for a list of field paths in a certain type.

Parameters
Name
Description
paths
Returns
Type
Description

fromStringList(Class<? extends Message> type, Iterable<String> paths)

  public 
  
 static 
  
 FieldMask 
  
 fromStringList 
 ( 
 Class 
< ? 
  
 extends 
  
 Message 
>  
 type 
 , 
  
 Iterable<String> 
  
 paths 
 ) 
 

Constructs a FieldMask for a list of field paths in a certain type.

Parameters
Name
Description
type
Class < ? extends com.google.protobuf.Message >
paths
Returns
Type
Description

fromStringList(Iterable<String> paths)

  public 
  
 static 
  
 FieldMask 
  
 fromStringList 
 ( 
 Iterable<String> 
  
 paths 
 ) 
 

Constructs a FieldMask for a list of field paths in a certain type. Does not validate the given paths.

Parameter
Name
Description
paths
Returns
Type
Description

intersection(FieldMask mask1, FieldMask mask2)

  public 
  
 static 
  
 FieldMask 
  
 intersection 
 ( 
 FieldMask 
  
 mask1 
 , 
  
 FieldMask 
  
 mask2 
 ) 
 

Calculates the intersection of two FieldMasks.

Parameters
Name
Description
mask1
mask2
Returns
Type
Description

isValid(Descriptors.Descriptor descriptor, FieldMask fieldMask)

  public 
  
 static 
  
 boolean 
  
 isValid 
 ( 
 Descriptors 
 . 
 Descriptor 
  
 descriptor 
 , 
  
 FieldMask 
  
 fieldMask 
 ) 
 

Checks whether paths in a given fields mask are valid.

Parameters
Name
Description
fieldMask
Returns
Type
Description

isValid(Descriptors.Descriptor descriptor, String path)

  public 
  
 static 
  
 boolean 
  
 isValid 
 ( 
 Descriptors 
 . 
 Descriptor 
  
 descriptor 
 , 
  
 String 
  
 path 
 ) 
 

Checks whether paths in a given fields mask are valid.

Parameters
Name
Description
path
Returns
Type
Description

isValid(Class<? extends Message> type, FieldMask fieldMask)

  public 
  
 static 
  
 boolean 
  
 isValid 
 ( 
 Class 
< ? 
  
 extends 
  
 Message 
>  
 type 
 , 
  
 FieldMask 
  
 fieldMask 
 ) 
 

Checks whether paths in a given fields mask are valid.

Parameters
Name
Description
type
Class < ? extends com.google.protobuf.Message >
fieldMask
Returns
Type
Description

isValid(Class<? extends Message> type, String path)

  public 
  
 static 
  
 boolean 
  
 isValid 
 ( 
 Class 
< ? 
  
 extends 
  
 Message 
>  
 type 
 , 
  
 String 
  
 path 
 ) 
 

Checks whether a given field path is valid.

Parameters
Name
Description
type
Class < ? extends com.google.protobuf.Message >
path
Returns
Type
Description

merge(FieldMask mask, Message source, Message.Builder destination)

  public 
  
 static 
  
 void 
  
 merge 
 ( 
 FieldMask 
  
 mask 
 , 
  
 Message 
  
 source 
 , 
  
 Message 
 . 
 Builder 
  
 destination 
 ) 
 

Merges fields specified by a FieldMask from one message to another.

Parameters
Name
Description
mask
source
destination

merge(FieldMask mask, Message source, Message.Builder destination, FieldMaskUtil.MergeOptions options)

  public 
  
 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. The destination will remain unchanged if an empty FieldMask is provided.

Parameters
Name
Description
mask
source
destination

normalize(FieldMask mask)

  public 
  
 static 
  
 FieldMask 
  
 normalize 
 ( 
 FieldMask 
  
 mask 
 ) 
 

Converts a FieldMask to its canonical form. In the canonical form of a FieldMask, all field paths are sorted alphabetically and redundant field paths are removed.

Parameter
Name
Description
mask
Returns
Type
Description

subtract(FieldMask firstMask, FieldMask secondMask, FieldMask[] otherMasks)

  public 
  
 static 
  
 FieldMask 
  
 subtract 
 ( 
 FieldMask 
  
 firstMask 
 , 
  
 FieldMask 
  
 secondMask 
 , 
  
 FieldMask 
 [] 
  
 otherMasks 
 ) 
 

Subtracts 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".

Parameters
Name
Description
firstMask
secondMask
otherMasks
Returns
Type
Description

toJsonString(FieldMask fieldMask)

  public 
  
 static 
  
 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.

Parameter
Name
Description
fieldMask
Returns
Type
Description

toString(FieldMask fieldMask)

  public 
  
 static 
  
 String 
  
 toString 
 ( 
 FieldMask 
  
 fieldMask 
 ) 
 

Converts a FieldMask to a string.

Parameter
Name
Description
fieldMask
Returns
Type
Description

union(FieldMask firstMask, FieldMask secondMask, FieldMask[] otherMasks)

  public 
  
 static 
  
 FieldMask 
  
 union 
 ( 
 FieldMask 
  
 firstMask 
 , 
  
 FieldMask 
  
 secondMask 
 , 
  
 FieldMask 
 [] 
  
 otherMasks 
 ) 
 

Creates a union of two or more FieldMasks.

Parameters
Name
Description
firstMask
secondMask
otherMasks
Returns
Type
Description
Create a Mobile Website
View Site in Mobile | Classic
Share by: