Class FieldPath

java.lang.Object
com.yahoo.document.FieldPath
All Implemented Interfaces:
Iterable<FieldPathEntry>

public class FieldPath extends Object implements 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 Details

    • 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:
      NullPointerException - If the specified path is null.
    • FieldPath

      public FieldPath(List<FieldPathEntry> path)
  • Method Details

    • size

      public int size()
    • get

      public FieldPathEntry get(int index)
    • isEmpty

      public boolean isEmpty()
    • iterator

      public Iterator<FieldPathEntry> iterator()
      Specified by:
      iterator in interface Iterable<FieldPathEntry>
    • getList

      public List<FieldPathEntry> getList()
    • 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, 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(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object