Class FieldPath

  • All Implemented Interfaces:
    java.lang.Iterable<FieldPathEntry>

    public class FieldPath
    extends java.lang.Object
    implements java.lang.Iterable<FieldPathEntry>
    This class represents a path into a document, that can be used to iterate through the document and extract the field values you're interested in.
    Author:
    Thomas Gundersen
    • Constructor Detail

      • FieldPath

        public FieldPath()
        Constructs an empty path.
      • FieldPath

        public FieldPath​(FieldPath path)
        Constructs a path containing the entries of the specified path, in the order they are returned by that path's iterator.
        Parameters:
        path - The path whose entries are to be placed into this path.
        Throws:
        java.lang.NullPointerException - If the specified path is null.
      • FieldPath

        public FieldPath​(java.util.List<FieldPathEntry> path)
    • Method Detail

      • size

        public int size()
      • isEmpty

        public boolean isEmpty()
      • startsWith

        public boolean startsWith​(FieldPath other)
        Compares this field path with the given field path, returns true if the field path starts with the other.
        Parameters:
        other - The field path to compare with.
        Returns:
        Returns true if this field path starts with the other field path, otherwise false
      • getResultingDataType

        public DataType getResultingDataType()
        Returns:
        Returns the datatype we can expect this field path to return.
      • newInstance

        public static FieldPath newInstance​(DataType fieldType,
                                            java.lang.String fieldPath)
        Convenience method to build a field path from a path string. This is a simple proxy for DataType.buildFieldPath(String).
        Parameters:
        fieldType - The data type of the value to build a path for.
        fieldPath - The path string to parse.
        Returns:
        The corresponding field path object.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object