@sap-cloud-sdk/odata-common
Version:
SAP Cloud SDK for JavaScript common functions of OData client generator and OpenAPI clint generator.
38 lines • 1.84 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CollectionField = void 0;
const field_1 = require("./field");
const 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 DeSerializersT - Type of the (de-)serializers.
* @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.
*/
class CollectionField extends field_1.Field {
/**
* 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.
*/
constructor(fieldName, _fieldOf, _fieldType, fieldOptions) {
super(fieldName, (0, complex_type_field_1.getEntityConstructor)(_fieldOf), fieldOptions);
this._fieldOf = _fieldOf;
this._fieldType = _fieldType;
}
/**
* Gets the path to the complex type property represented by this.
* @returns The path to the complex type property.
*/
fieldPath() {
return this._fieldOf instanceof complex_type_field_1.ComplexTypeField
? `${this._fieldOf.fieldPath()}/${this._fieldName}`
: this._fieldName;
}
}
exports.CollectionField = CollectionField;
//# sourceMappingURL=collection-field.js.map