Package com.yahoo.document
Class FieldPath
- java.lang.Object
-
- com.yahoo.document.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 Summary
Constructors Constructor Description FieldPath()
Constructs an empty path.FieldPath(FieldPath path)
Constructs a path containing the entries of the specified path, in the order they are returned by that path's iterator.FieldPath(java.util.List<FieldPathEntry> path)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
FieldPathEntry
get(int index)
java.util.List<FieldPathEntry>
getList()
DataType
getResultingDataType()
int
hashCode()
boolean
isEmpty()
java.util.Iterator<FieldPathEntry>
iterator()
static FieldPath
newInstance(DataType fieldType, java.lang.String fieldPath)
Convenience method to build a field path from a path string.int
size()
boolean
startsWith(FieldPath other)
Compares this field path with the given field path, returns true if the field path starts with the other.java.lang.String
toString()
-
-
-
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()
-
get
public FieldPathEntry get(int index)
-
isEmpty
public boolean isEmpty()
-
iterator
public java.util.Iterator<FieldPathEntry> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<FieldPathEntry>
-
getList
public java.util.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, java.lang.String fieldPath)
Convenience method to build a field path from a path string. This is a simple proxy forDataType.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 classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-