Class FieldPath

java.lang.Object
io.deephaven.protobuf.FieldPath

@Immutable public abstract class FieldPath extends Object
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 Details

    • FieldPath

      public FieldPath()
  • Method Details

    • empty

      public static FieldPath empty()
      Creates an empty field path. Equivalent to of(List.of()).
      Returns:
      the empty field path
    • of

      public static FieldPath of(com.google.protobuf.Descriptors.FieldDescriptor... descriptors)
      Creates a field path with descriptors.
      Parameters:
      descriptors - the descriptors
      Returns:
      the field path
    • of

      public static FieldPath of(List<com.google.protobuf.Descriptors.FieldDescriptor> descriptors)
      Creates a field path with descriptors.
      Parameters:
      descriptors - the descriptors
      Returns:
      the field path
    • matches

      public static ToBooleanFunction<FieldPath> matches(String simplePath)
      Creates a boolean function according to simplePath, where simplePath represents a name path that is '/' separated. The final name path part may be a '*' to additionally match everything that starts with simplePath.

      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

      public static ToBooleanFunction<FieldPath> anyMatches(List<String> simplePaths)
      Creates a boolean function that is true when any component of simplePaths would matches(String).

      Equivalent to ToBooleanFunction.or(simplePaths.stream().map(FieldPath::matches).collect(Collectors.toList())).

      Parameters:
      simplePaths - the simple paths
      Returns:
      the field path function
    • path

      @Parameter public abstract List<com.google.protobuf.Descriptors.FieldDescriptor> path()
      The ordered field descriptors which make up the field path.
      Returns:
      the path
    • numberPath

      @Lazy public FieldNumberPath numberPath()
      The number path for this field path. Equivalent to FieldNumberPath.of(path().stream().mapToInt(FieldDescriptor::getNumber).toArray()).
      Returns:
      the number path
    • namePath

      @Lazy public List<String> namePath()
      The name path for this field path. Equivalent to path().stream().map(FieldDescriptor::getName).collect(Collectors.toList()).
      Returns:
      the name path
    • startsWith

      public final boolean startsWith(List<String> prefix)
    • otherStartsWithThis

      public final boolean otherStartsWithThis(List<String> other)