Package com.yahoo.document
Class FieldPathEntry
- java.lang.Object
-
- com.yahoo.document.FieldPathEntry
-
public class FieldPathEntry extends java.lang.Object
- Author:
- thomasg
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FieldPathEntry.KeyParseResult
static class
FieldPathEntry.Type
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Field
getFieldRef()
int
getLookupIndex()
FieldValue
getLookupKey()
DataType
getResultingDataType()
FieldPathEntry.Type
getType()
java.lang.String
getVariableName()
int
hashCode()
static FieldPathEntry
newAllKeysLookupEntry(DataType resultingDataType)
Creates a new field path entry that digs through all the keys of a map or weighted set.static FieldPathEntry
newAllValuesLookupEntry(DataType resultingDataType)
Creates a new field path entry that digs through all the values of a map or weighted set.static FieldPathEntry
newArrayLookupEntry(int lookupIndex, DataType resultingDataType)
Creates a new field path entry that references an array index.static FieldPathEntry
newMapLookupEntry(FieldValue lookupKey, DataType resultingDataType)
Creates a new field path entry that references a map or weighted set.static FieldPathEntry
newStructFieldEntry(Field fieldRef)
Creates a new field path entry that references a struct field.static FieldPathEntry
newVariableLookupEntry(java.lang.String variableName, DataType resultingDataType)
Creates a new field path entry that digs through all the keys in a map or weighted set, or all the indexes of an array, an sets the given variable name as it does so (or, if the variable is set, uses the set variable to look up the collection.static FieldPathEntry.KeyParseResult
parseKey(java.lang.String key)
Parse a field path map key of the form {xyz} or {"xyz"} with optional trailing data.java.lang.String
toString()
-
-
-
Method Detail
-
getResultingDataType
public DataType getResultingDataType()
-
getType
public FieldPathEntry.Type getType()
-
getFieldRef
public Field getFieldRef()
-
getLookupIndex
public int getLookupIndex()
-
getLookupKey
public FieldValue getLookupKey()
-
getVariableName
public java.lang.String getVariableName()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
newStructFieldEntry
public static FieldPathEntry newStructFieldEntry(Field fieldRef)
Creates a new field path entry that references a struct field. For these kinds of field path entries, getFieldRef() is valid.- Parameters:
fieldRef
- The field to look up in the struct.- Returns:
- The new field path entry
-
newArrayLookupEntry
public static FieldPathEntry newArrayLookupEntry(int lookupIndex, DataType resultingDataType)
Creates a new field path entry that references an array index.- Parameters:
lookupIndex
- The index to look upresultingDataType
- The datatype of the contents of the array- Returns:
- The new field path entry
-
newMapLookupEntry
public static FieldPathEntry newMapLookupEntry(FieldValue lookupKey, DataType resultingDataType)
Creates a new field path entry that references a map or weighted set.- Parameters:
lookupKey
- The value of the key in the map or weighted set to recurse into.resultingDataType
- The datatype of values in the map or weighted set.- Returns:
- The new field path entry
-
newAllKeysLookupEntry
public static FieldPathEntry newAllKeysLookupEntry(DataType resultingDataType)
Creates a new field path entry that digs through all the keys of a map or weighted set.- Parameters:
resultingDataType
- The datatype of the keys in the map or weighted set.- Returns:
- The new field path entry.
-
newAllValuesLookupEntry
public static FieldPathEntry newAllValuesLookupEntry(DataType resultingDataType)
Creates a new field path entry that digs through all the values of a map or weighted set.- Parameters:
resultingDataType
- The datatype of the values in the map or weighted set.- Returns:
- The new field path entry.
-
newVariableLookupEntry
public static FieldPathEntry newVariableLookupEntry(java.lang.String variableName, DataType resultingDataType)
Creates a new field path entry that digs through all the keys in a map or weighted set, or all the indexes of an array, an sets the given variable name as it does so (or, if the variable is set, uses the set variable to look up the collection.- Parameters:
variableName
- The name of the variable to lookup in the collectionresultingDataType
- The value type of the collection we're digging through- Returns:
- The new field path entry.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
parseKey
public static FieldPathEntry.KeyParseResult parseKey(java.lang.String key)
Parse a field path map key of the form {xyz} or {"xyz"} with optional trailing data. If the key contains a '}' or '"' character, the key must be in quotes and all double-quote characters must be escaped. Only '"' chars may be escaped. Any trailing string data past the '}' is ignored.- Parameters:
key
- Part of a field path that contains a key at its start- Returns:
- A parse result containing the parsed/unescaped key and the number of input characters the parse consumed. Does not include any characters beyond the '}' char.
-
-