UNPKG

@sap/odata-v4

Version:

OData V4.0 server library

78 lines (68 loc) 1.77 kB
'use strict'; /** * @hideconstructor */ class ExpandItem { /** * Create an expand item. */ constructor() { this._path = []; this._isAll = false; this._options = {}; } /** * Return the path segments. * @returns {UriResource[]} the path segments */ getPathSegments() { return this._path; } /** * Set the path segments. * @param {UriResource[]} path the path segments * @returns {ExpandItem} this expand item * @package */ setPathSegments(path) { this._path = path; return this; } /** * Return whether '*' has been specified for the (potentially empty) path. * @returns {boolean} whether '*' has been specified */ isAll() { return this._isAll; } /** * Set the information whether '*' has been specified. * @param {boolean} isAll whether '*' has been specified * @returns {ExpandItem} this expand item * @package */ setAll(isAll) { this._isAll = isAll; return this; } /** * Return the value for an option. * @param {string} name the name of the option * @returns {(string|number|boolean|Expression|OrderByItem[]|ExpandItem[]|SelectItem[])} the value */ getOption(name) { return this._options[name]; } /** * Set the value for an option. * @param {string} name the name of the option * @param {(string|number|boolean|Expression|OrderByItem[]|ExpandItem[]|SelectItem[])} value the value * @returns {ExpandItem} this expand item * @package */ setOption(name, value) { this._options[name] = value; return this; } } module.exports = ExpandItem;