UNPKG

@sap-cloud-sdk/core

Version:
55 lines 2.76 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.CollectionField = void 0; var field_1 = require("./field"); var complex_type_field_1 = require("./complex-type-field"); /** * Represents a field of an entity or a complex type, that can have a collection as value. * @typeparam EntityT - Type of the entity the field belongs to. * @typeparam CollectionFieldT - Type of of elements of the collection. This can either be an EDM type or complex type. * @typeparam NullableT - Boolean type that represents whether the field is nullable. * @typeparam SelectableT - Boolean type that represents whether the field is selectable. */ var CollectionField = /** @class */ (function (_super) { __extends(CollectionField, _super); /** * Creates an instance of CollectionField. * @param fieldName - Actual name of the field used in the OData request. * @param _fieldOf - The constructor of the entity or the complex type field this field belongs to. * @param _fieldType - Edm type of the field according to the metadata description. * @param fieldOptions - Optional settings for this field. */ function CollectionField(fieldName, _fieldOf, _fieldType, fieldOptions) { var _this = _super.call(this, fieldName, (0, complex_type_field_1.getEntityConstructor)(_fieldOf), fieldOptions) || this; _this._fieldOf = _fieldOf; _this._fieldType = _fieldType; return _this; } /** * Gets the path to the complex type property represented by this. * @returns The path to the complex type property. */ CollectionField.prototype.fieldPath = function () { return this._fieldOf instanceof complex_type_field_1.ComplexTypeField ? "".concat(this._fieldOf.fieldPath(), "/").concat(this._fieldName) : this._fieldName; }; return CollectionField; }(field_1.Field)); exports.CollectionField = CollectionField; //# sourceMappingURL=collection-field.js.map