@sap/odata-v4
Version:
OData V4.0 server library
72 lines (63 loc) • 1.64 kB
JavaScript
'use strict';
/**
* Grouping property.
* @hideconstructor
*/
class GroupByItem {
constructor() {
this._pathSegments = [];
this._isRollupAll = false;
this._rollup = [];
}
/**
* Return the path segments.
* @returns {UriResource[]} a potentially empty list of path segments
*/
getPathSegments() {
return this._pathSegments;
}
/**
* Set the path segments.
* @param {UriResource[]} pathSegments a potentially empty list of path segments
* @returns {GroupByItem} this group-by item
* @package
*/
setPathSegments(pathSegments) {
this._pathSegments = pathSegments;
return this;
}
/**
* Return whether a nested rollup clause contains the special value '$all'.
* @returns {boolean} whether a nested rollup clause contains the special value '$all'
*/
isRollupAll() {
return this._isRollupAll;
}
/**
* Record that a nested rollup clause contains the special value '$all'.
* @returns {GroupByItem} this group-by item
* @package
*/
setIsRollupAll() {
this._isRollupAll = true;
return this;
}
/**
* Return the rollup.
* @returns {GroupByItem[]} a potentially empty list of grouping items
*/
getRollup() {
return this._rollup;
}
/**
* Add a rollup item.
* @param {GroupByItem} item the rollup item
* @returns {GroupByItem} this group-by item
* @package
*/
addRollupItem(item) {
this._rollup.push(item);
return this;
}
}
module.exports = GroupByItem;