Package com.yahoo.document
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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
FieldPathEntry
get(int index)
List<FieldPathEntry>
getList()
DataType
getResultingDataType()
int
hashCode()
boolean
isEmpty()
Iterator<FieldPathEntry>
iterator()
static FieldPath
newInstance(DataType fieldType, 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.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
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:
NullPointerException
- If the specified path is null.
-
FieldPath
public FieldPath(List<FieldPathEntry> path)
-
-
Method Detail
-
size
public int size()
-
get
public FieldPathEntry get(int index)
-
isEmpty
public boolean isEmpty()
-
iterator
public Iterator<FieldPathEntry> iterator()
- Specified by:
iterator
in interfaceIterable<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 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.
-
-