Go to the documentation of this file.
31 package com.google.protobuf.util;
33 import static com.
google.common.base.Preconditions.checkArgument;
39 import com.
google.errorprone.annotations.CanIgnoreReturnValue;
45 import java.util.ArrayList;
46 import java.util.Arrays;
47 import java.util.List;
64 StringBuilder result =
new StringBuilder();
66 for (String
value : fieldMask.getPathsList()) {
67 if (
value.isEmpty()) {
78 return result.toString();
107 for (String
path : paths) {
108 if (
path.isEmpty()) {
113 throw new IllegalArgumentException(
path +
" is not a valid path for " +
type);
115 builder.addPaths(
path);
117 return builder.build();
135 Class<? extends Message>
type, Iterable<Integer> fieldNumbers) {
139 for (Integer fieldNumber : fieldNumbers) {
143 String.format(
"%s is not a valid field number for %s.", fieldNumber,
type));
144 builder.addPaths(
field.getName());
146 return builder.build();
154 List<String> paths =
new ArrayList<String>(fieldMask.getPathsCount());
155 for (String
path : fieldMask.getPathsList()) {
156 if (
path.isEmpty()) {
159 paths.add(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL,
path));
171 for (String
path : paths) {
172 if (
path.isEmpty()) {
175 builder.addPaths(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE,
path));
177 return builder.build();
193 for (String
path : fieldMask.getPathsList()) {
215 if (parts.length == 0) {
218 for (String
name : parts) {
241 return new FieldMaskTree(
mask).toFieldMask();
249 FieldMaskTree maskTree =
new FieldMaskTree(firstMask).mergeFromFieldMask(secondMask);
251 maskTree.mergeFromFieldMask(
mask);
253 return maskTree.toFieldMask();
260 FieldMaskTree
tree =
new FieldMaskTree(mask1);
261 FieldMaskTree result =
new FieldMaskTree();
262 for (String
path : mask2.getPathsList()) {
263 tree.intersectFieldPath(
path, result);
265 return result.toFieldMask();
310 @CanIgnoreReturnValue
323 @CanIgnoreReturnValue
340 @CanIgnoreReturnValue
static boolean isValid(Class<? extends Message > type, String path)
GLuint const GLchar * name
static boolean isValid(Descriptor descriptor, FieldMask fieldMask)
boolean replaceMessageFields()
static final String FIELD_SEPARATOR_REGEX
static FieldMask normalize(FieldMask mask)
MergeOptions setReplaceMessageFields(boolean value)
struct FieldMask FieldMask
static FieldMask fromFieldNumbers(Class<? extends Message > type, Iterable< Integer > fieldNumbers)
static String toString(FieldMask fieldMask)
MergeOptions setReplaceRepeatedFields(boolean value)
static FieldMask fromFieldNumbers(Class<? extends Message > type, int... fieldNumbers)
boolean replacePrimitiveFields()
static FieldMask fromString(String value)
MergeOptions setReplacePrimitiveFields(boolean value)
GLsizei const GLchar ** path
static final String FIELD_PATH_SEPARATOR_REGEX
static String toJsonString(FieldMask fieldMask)
static void merge(FieldMask mask, Message source, Message.Builder destination, MergeOptions options)
GLsizei GLsizei GLchar * source
const FieldDescriptor * field
static FieldMask fromStringList(Class<? extends Message > type, Iterable< String > paths)
static FieldMask intersection(FieldMask mask1, FieldMask mask2)
static FieldMask fromString(Class<? extends Message > type, String value)
static< T extends MessageLite > T getDefaultInstance(Class< T > clazz)
boolean replacePrimitiveFields
boolean replaceMessageFields
static boolean isValid(Descriptor descriptor, String path)
static FieldMask fromJsonString(String value)
static void merge(FieldMask mask, Message source, Message.Builder destination)
boolean replaceRepeatedFields()
static final String FIELD_PATH_SEPARATOR
GLsizei const GLfloat * value
static boolean isValid(Class<? extends Message > type, FieldMask fieldMask)
boolean replaceRepeatedFields
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:51