@sap/odata-v4
Version:
OData V4.0 server library
46 lines (38 loc) • 1.14 kB
JavaScript
;
const Expression = require('./Expression');
/**
* @extends Expression
* @hideconstructor
*/
class MemberExpression extends Expression {
/**
* Create an instance of MemberExpression.
* @param {UriResource[]} pathSegments path segments
*/
constructor(pathSegments) {
super(Expression.ExpressionKind.MEMBER);
this._pathSegments = pathSegments;
}
/**
* Return the path segments.
* @returns {UriResource[]} path segments
*/
getPathSegments() {
return this._pathSegments;
}
/**
* Return the EDM type of this expression or null if there is none.
* @returns {?EdmType} the EDM type of this expression or null if there is none
*/
getType() {
return this._pathSegments[this._pathSegments.length - 1].getEdmType();
}
/**
* Return true if this expression is a collection.
* @returns {boolean} true if this expression is a collection, else false
*/
isCollection() {
return this._pathSegments[this._pathSegments.length - 1].isCollection();
}
}
module.exports = MemberExpression;