public class DataPath extends PropertyPath
Used together with DataQuery to represent a select, expand or sort item which is a single-part or multi-part path expression.
For example, a path whose OData URL representation is "Address/City" might be used to access the "City" property in a complex-typed "Address" property.
Also used to represent paths in OData CSDL.
| Modifier and Type | Method and Description |
|---|---|
DataPath |
atIndex(int itemIndex)
Sets the item index to address an element of a collection typed property.
|
static DataPath |
castOptional(DataValue value)
For internal use only.
|
static DataPath |
castRequired(DataValue value)
For internal use only.
|
DataPath |
dynamicPath(java.lang.String child)
Construct a new multi-part path, with this path as the
DataPath.parentPath. |
DataType |
getDataType()
Return data type with a
DataType.code of DataType.PATH, DataType.PATH_EXPRESSION, DataType.ANNOTATION_PATH, DataType.NAVIGATION_PATH, DataType.STRUCTURAL_PATH, or DataType.DYNAMIC_PATH. |
Property |
getDefinedProperty()
Return (nullable) The defined property for a single-part path or the terminating defined property for a multi-part path.
|
java.lang.String |
getDynamicProperty()
Return (nullable) The dynamic property for a single-part path or the terminating dynamic property for a multi-part path.
|
EntityKey |
getEntityKey()
Return (nullable) The entity key of the element in an entity collection.
|
java.lang.Integer |
getItemIndex()
Return (nullable) The index of an element in a collection.
|
java.lang.String |
getLambdaVariable()
Return (nullable) The lambda variable name for a lambda variable path.
|
DataPath |
getParentPath()
Return (nullable) The parent path for a multi-part path;
null for a single-part path. |
StringList |
getPathSegments()
Return the '/'-separated segments in this path, as a list.
|
int |
getPathType()
Return data type code of DataType.PATH, DataType.PATH_EXPRESSION, DataType.ANNOTATION_PATH, DataType.NAVIGATION_PATH, DataType.STRUCTURAL_PATH, or DataType.DYNAMIC_PATH.
|
Property |
getRootProperty()
Return (nullable) The
DataPath.definedProperty from the topmost DataPath.parentPath in this path, or null if unknown. |
int |
getSegmentCount()
Return the number of segments in this path.
|
boolean |
hasSegments()
Return
true if this path has segments. |
boolean |
isNavigation()
Return
true if this path has type DataType.NAVIGATION_PATH. |
boolean |
isProperty(Property property)
Return
true if this path is simply for the specified target property. |
boolean |
isStructural()
Return
true if this path has type DataType.STRUCTURAL_PATH. |
static DataPath |
lambda(java.lang.String name)
Construct a lambda variable path (for use with 'any' and 'all' lambda operators).
|
static DataPath |
of(Property start)
Construct a new single-part path.
|
static DataPath |
ofDynamic(java.lang.String start)
Construct a new single-part path.
|
DataPath |
path(Property child)
Construct a new multi-part path, with this path as the
DataPath.parentPath. |
static DataPath |
toDynamic(StringList segments)
Return a new data path with the specified
type, using chained DataPath.parentPath and DataPath.dynamicProperty rather than DataPath.pathSegments. |
DataPath |
toPath()
Return this property or path, expressed as a
DataPath. |
java.lang.String |
toString()
Return the OData CSDL path expression syntax for this path ('/'-separated segments).
|
DataValue |
unwrap()
Return the path, property, constant value or query function/operator call which is wrapped by this object.
|
DataPath |
withKey(EntityKey entityKey)
Sets the entity key to address an element of an entity collection.
|
static DataPath |
withSegments(int type,
StringList segments)
Return a new data path with the specified
type and segments. |
add, add, add, add, add, add, add, all, any, asType, average, ceiling, concat, concat, contains, contains, countDistinct, date, day, divide, divide, divide, divide, divide, divide, divide, endsWith, endsWith, equal, equal, equal, equal, equal, equal, equal, equal, equal, floor, fractionalSeconds, geoDistance, geoIntersectse, geoLength, greaterEqual, greaterEqual, greaterEqual, greaterEqual, greaterEqual, greaterEqual, greaterEqual, greaterEqual, greaterEqual, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, has, hour, indexOf, indexOf, isNull, isType, length, lessEqual, lessEqual, lessEqual, lessEqual, lessEqual, lessEqual, lessEqual, lessEqual, lessEqual, lessThan, lessThan, lessThan, lessThan, lessThan, lessThan, lessThan, lessThan, lessThan, maximum, minimum, minute, modulo, modulo, modulo, modulo, modulo, modulo, modulo, month, multiply, multiply, multiply, multiply, multiply, multiply, multiply, negate, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notNull, round, second, startsWith, startsWith, substring, substring, substring, substring, subtract, subtract, subtract, subtract, subtract, subtract, subtract, sum, time, toLower, totalOffsetMinutes, toUpper, trim, wrap, yearcloneMutable, equals, getTypeCode, hashCodepublic DataPath atIndex(int itemIndex)
Sets the item index to address an element of a collection typed property.
itemIndex - Zero-based index of the element in the collection.public static DataPath castOptional(DataValue value)
For internal use only.
value - (internal use only)public static DataPath castRequired(DataValue value)
For internal use only.
value - (internal use only)public DataPath dynamicPath(java.lang.String child)
Construct a new multi-part path, with this path as the DataPath.parentPath.
child - Value for DataPath.dynamicProperty in the new path.public DataType getDataType()
Return data type with a DataType.code of DataType.PATH, DataType.PATH_EXPRESSION, DataType.ANNOTATION_PATH, DataType.NAVIGATION_PATH, DataType.STRUCTURAL_PATH, or DataType.DYNAMIC_PATH.
getDataType in class QueryValueDataType.code of DataType.PATH, DataType.PATH_EXPRESSION, DataType.ANNOTATION_PATH, DataType.NAVIGATION_PATH, DataType.STRUCTURAL_PATH, or DataType.DYNAMIC_PATH.public Property getDefinedProperty()
Return (nullable) The defined property for a single-part path or the terminating defined property for a multi-part path.
public java.lang.String getDynamicProperty()
Return (nullable) The dynamic property for a single-part path or the terminating dynamic property for a multi-part path.
public EntityKey getEntityKey()
Return (nullable) The entity key of the element in an entity collection.
public java.lang.Integer getItemIndex()
Return (nullable) The index of an element in a collection.
public java.lang.String getLambdaVariable()
Return (nullable) The lambda variable name for a lambda variable path.
public DataPath getParentPath()
Return (nullable) The parent path for a multi-part path; null for a single-part path.
public StringList getPathSegments()
Return the '/'-separated segments in this path, as a list.
public int getPathType()
Return data type code of DataType.PATH, DataType.PATH_EXPRESSION, DataType.ANNOTATION_PATH, DataType.NAVIGATION_PATH, DataType.STRUCTURAL_PATH, or DataType.DYNAMIC_PATH.
public Property getRootProperty()
Return (nullable) The DataPath.definedProperty from the topmost DataPath.parentPath in this path, or null if unknown.
DataPath.definedProperty from the topmost DataPath.parentPath in this path, or null if unknown.public int getSegmentCount()
Return the number of segments in this path.
public boolean hasSegments()
Return true if this path has segments.
true if this path has segments.public boolean isNavigation()
Return true if this path has type DataType.NAVIGATION_PATH.
true if this path has type DataType.NAVIGATION_PATH.public boolean isProperty(Property property)
Return true if this path is simply for the specified target property.
property - Specified target property.true if this path is simply for the specified target property.public boolean isStructural()
Return true if this path has type DataType.STRUCTURAL_PATH.
true if this path has type DataType.STRUCTURAL_PATH.public static DataPath lambda(java.lang.String name)
Construct a lambda variable path (for use with 'any' and 'all' lambda operators).
name - Lambda variable name.public static DataPath of(Property start)
Construct a new single-part path.
start - Value for DataPath.definedProperty in the new path.public static DataPath ofDynamic(java.lang.String start)
Construct a new single-part path.
start - Value for DataPath.dynamicProperty in the new path.public DataPath path(Property child)
Construct a new multi-part path, with this path as the DataPath.parentPath.
child - Value for DataPath.definedProperty in the new path.public static DataPath toDynamic(StringList segments)
Return a new data path with the specified type, using chained DataPath.parentPath and DataPath.dynamicProperty rather than DataPath.pathSegments.
segments - Path segments. Must not be empty.DataPath.parentPath and DataPath.dynamicProperty rather than DataPath.pathSegments.public DataPath toPath()
Return this property or path, expressed as a DataPath.
toPath in class PropertyPathDataPath.public java.lang.String toString()
Return the OData CSDL path expression syntax for this path ('/'-separated segments).
toString in class QueryValuepublic DataValue unwrap()
Return the path, property, constant value or query function/operator call which is wrapped by this object.
unwrap in class QueryValuepublic DataPath withKey(EntityKey entityKey)
Sets the entity key to address an element of an entity collection.
entityKey - Entity key of the element in the entity collection.public static DataPath withSegments(int type, StringList segments)
Return a new data path with the specified type and segments.
type - Value for DataPath.pathType.segments - Value for DataPath.pathSegments.type and segments.