Package io.deephaven.protobuf
Class FieldPath
java.lang.Object
io.deephaven.protobuf.FieldPath
The
path() to a Descriptor's field.
Descriptors.FieldDescriptor objects are not equal across dynamic messages.
Helpers numberPath() and namePath() may be used in lieu of direct equivalence depending on context.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ToBooleanFunction<FieldPath>anyMatches(List<String> simplePaths) static FieldPathempty()Creates an empty field path.static ToBooleanFunction<FieldPath>Creates a boolean function according tosimplePath, wheresimplePathrepresents aname paththat is '/' separated.namePath()The name path for this field path.The number path for this field path.static FieldPathof(com.google.protobuf.Descriptors.FieldDescriptor... descriptors) Creates a field path withdescriptors.static FieldPathCreates a field path withdescriptors.final booleanotherStartsWithThis(List<String> other) abstract List<com.google.protobuf.Descriptors.FieldDescriptor>path()The ordered field descriptors which make up the field path.final booleanstartsWith(List<String> prefix)
-
Constructor Details
-
FieldPath
public FieldPath()
-
-
Method Details
-
empty
Creates an empty field path. Equivalent toof(List.of()).- Returns:
- the empty field path
-
of
Creates a field path withdescriptors.- Parameters:
descriptors- the descriptors- Returns:
- the field path
-
of
Creates a field path withdescriptors.- Parameters:
descriptors- the descriptors- Returns:
- the field path
-
matches
Creates a boolean function according tosimplePath, wheresimplePathrepresents aname paththat is '/' separated. The final name path part may be a '*' to additionally match everything that starts withsimplePath.For example,
simplePath="/foo/bar"will provide a function that matches the field path name paths[],["foo"], and["foo", "bar"].simplePath="/foo/bar/*"will provide a function that matches the previous example, as well as any field path name paths that start with["foo", "bar"]:["foo", "bar", "baz"],["foo", "bar", "baz", "zap",["foo", "bar", "zip"], etc.- Parameters:
simplePath- the simple path- Returns:
- the field path function
-
anyMatches
Creates a boolean function that istruewhen any component ofsimplePathswouldmatches(String).Equivalent to
ToBooleanFunction.or(simplePaths.stream().map(FieldPath::matches).collect(Collectors.toList())).- Parameters:
simplePaths- the simple paths- Returns:
- the field path function
-
path
The ordered field descriptors which make up the field path.- Returns:
- the path
-
numberPath
The number path for this field path. Equivalent toFieldNumberPath.of(path().stream().mapToInt(FieldDescriptor::getNumber).toArray()).- Returns:
- the number path
-
namePath
The name path for this field path. Equivalent topath().stream().map(FieldDescriptor::getName).collect(Collectors.toList()).- Returns:
- the name path
-
startsWith
-
otherStartsWithThis
-