@sap-cloud-sdk/odata-common
Version:
SAP Cloud SDK for JavaScript common functions of OData client generator and OpenAPI clint generator.
57 lines • 2.63 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomField = void 0;
const field_1 = require("./field");
const field_builder_1 = require("./field-builder");
/**
* If your entity contains fields not present in your service specification you can model them using custom fields.
* Alternatively you can also generate a client based on a service specification containing all fields.
*/
class CustomField extends field_1.Field {
constructor(fieldName, entityConstructor, deSerializers, isNullable = false) {
super(fieldName, entityConstructor, { isNullable });
this.deSerializers = deSerializers;
this.fieldBuilder = new field_builder_1.FieldBuilder(entityConstructor, this.deSerializers);
}
edmString() {
return this.fieldBuilder.buildEdmTypeField(this._fieldName, 'Edm.String', this._fieldOptions.isNullable);
}
edmBoolean() {
return this.fieldBuilder.buildEdmTypeField(this._fieldName, 'Edm.Boolean', this._fieldOptions.isNullable);
}
edmGuid() {
return this.fieldBuilder.buildEdmTypeField(this._fieldName, 'Edm.Guid', this._fieldOptions.isNullable);
}
edmDecimal() {
return this.fieldBuilder.buildEdmTypeField(this._fieldName, 'Edm.Decimal', this._fieldOptions.isNullable);
}
edmInt16() {
return this.fieldBuilder.buildEdmTypeField(this._fieldName, 'Edm.Int16', this._fieldOptions.isNullable);
}
edmInt32() {
return this.fieldBuilder.buildEdmTypeField(this._fieldName, 'Edm.Int32', this._fieldOptions.isNullable);
}
edmInt64() {
return this.fieldBuilder.buildEdmTypeField(this._fieldName, 'Edm.Int64', this._fieldOptions.isNullable);
}
edmSingle() {
return this.fieldBuilder.buildEdmTypeField(this._fieldName, 'Edm.Single', this._fieldOptions.isNullable);
}
edmDouble() {
return this.fieldBuilder.buildEdmTypeField(this._fieldName, 'Edm.Double', this._fieldOptions.isNullable);
}
edmByte() {
return this.fieldBuilder.buildEdmTypeField(this._fieldName, 'Edm.Byte', this._fieldOptions.isNullable);
}
edmSByte() {
return this.fieldBuilder.buildEdmTypeField(this._fieldName, 'Edm.SByte', this._fieldOptions.isNullable);
}
edmDateTimeOffset() {
return this.fieldBuilder.buildEdmTypeField(this._fieldName, 'Edm.DateTimeOffset', this._fieldOptions.isNullable);
}
edmBinary() {
return this.fieldBuilder.buildEdmTypeField(this._fieldName, 'Edm.Binary', this._fieldOptions.isNullable);
}
}
exports.CustomField = CustomField;
//# sourceMappingURL=custom-field.js.map