@sap/odata-v4
Version:
OData V4.0 server library
71 lines (60 loc) • 1.52 kB
JavaScript
;
const EdmAnnotation = require('./EdmAnnotation');
const validateThat = require('../validator/ParameterValidator').validateThat;
/**
* <a href="./../ODataSpecification/odata-v4.0-errata03-os/complete/part3-csdl/odata-v4.0-errata03-os-part3-csdl-complete.html#_Toc453752543">
* OData CSDL # 7.2 Element edm:ReferentialConstraint
* </a>
* @hideconstructor
*/
class EdmInclude {
/**
* Constructor
*
* @param {Edm} edm The EDM itself
* @param {CsdlInclude} include
*/
constructor(edm, include) {
validateThat('edm', edm).truthy();
validateThat('include', include).truthy();
/**
* @type {Edm}
* @private
*/
this._edm = edm;
/**
* @type {CsdlInclude}
* @private
*/
this._include = include;
this._annotations = null;
}
/**
* Return the namespace
*
* @returns {string}
*/
getNamespace() {
return this._include.namespace;
}
/**
* Return the alias
*
* @returns {string}
*/
getAlias() {
return this._include.alias;
}
/**
* Returns the annotations for this include.
*
* @returns {EdmAnnotation[]}
*/
getAnnotations() {
if (!this._annotations) {
this._annotations = this._include.annotations.map(item => new EdmAnnotation(this._edm, item));
}
return this._annotations;
}
}
module.exports = EdmInclude;