For example, FieldMask "foo.bar,foo.baz,bar.baz" as a tree will be:
[root] -+- foo -+- bar
| |
| +- baz
|
+- bar --- baz
By representing FieldMasks with this tree structure we can easily convert a FieldMask to a canonical form, merge two FieldMasks, calculate the intersection to two FieldMasks and traverse all fields specified by the FieldMask in a message tree.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private static final Logger | |
| private final FieldMaskTree. |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv FieldMaskTree | |
| private void | getFieldPaths(FieldMaskTree.
Gathers all field paths in a sub-tree. |
| pack-priv void | intersectFieldPath(String path, FieldMaskTree output)
Adds the intersection of this tree with the given |
| pack-priv void | merge(Message source, Message.
Merges all fields specified by this FieldMaskTree from |
| private void | merge(FieldMaskTree.
Merges all fields specified by a sub-tree from |
| pack-priv FieldMaskTree | |
| pack-priv FieldMask | |
| public String |
| FIELD_PATH_SEPARATOR_REGEX | back to summary |
|---|---|
| private static final String FIELD_PATH_SEPARATOR_REGEX | |
| logger | back to summary |
|---|---|
| private static final Logger logger | |
| root | back to summary |
|---|---|
| private final FieldMaskTree. | |
| FieldMaskTree | back to summary |
|---|---|
| pack-priv FieldMaskTree() Creates an empty FieldMaskTree. | |
| FieldMaskTree | back to summary |
|---|---|
| pack-priv FieldMaskTree(FieldMask mask) Creates a FieldMaskTree for a given FieldMask. | |
| addFieldPath | back to summary |
|---|---|
| pack-priv FieldMaskTree addFieldPath(String path) Adds a field path to the tree. In a FieldMask, every field path matches the specified field as well as all its sub-fields. For example, a field path "foo.bar" matches field "foo.bar" and also "foo.bar.baz", etc. When adding a field path to the tree, redundant sub-paths will be removed. That is, after adding "foo.bar" to the tree, "foo.bar.baz" will be removed if it exists, which will turn the tree node for "foo.bar" to a leaf node. Likewise, if the field path to add is a sub-path of an existing leaf node, nothing will be changed in the tree.
| |
| getFieldPaths | back to summary |
|---|---|
| private void getFieldPaths(FieldMaskTree. Gathers all field paths in a sub-tree. | |
| intersectFieldPath | back to summary |
|---|---|
| pack-priv void intersectFieldPath(String path, FieldMaskTree output) Adds the intersection of this tree with the given | |
| merge | back to summary |
|---|---|
| pack-priv void merge(Message source, Message. Merges all fields specified by this FieldMaskTree from | |
| merge | back to summary |
|---|---|
| private void merge(FieldMaskTree. Merges all fields specified by a sub-tree from | |
| mergeFromFieldMask | back to summary |
|---|---|
| pack-priv FieldMaskTree mergeFromFieldMask(FieldMask mask) Merges all field paths in a FieldMask into this tree.
| |
| toFieldMask | back to summary |
|---|---|
| pack-priv FieldMask toFieldMask() Converts this tree to a FieldMask. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final SortedMap |
| Access | Constructor and Description |
|---|---|
| private |
| children | back to summary |
|---|---|
| pack-priv final SortedMap<String, FieldMaskTree. | |
| Node | back to summary |
|---|---|
| private Node() | |