UNPKG

@sap/odata-v4

Version:

OData V4.0 server library

63 lines (52 loc) 1.77 kB
'use strict'; const AnnotationFactory = require('./AnnotationExpressionFactory'); const CsdlAnnotationExpression = require('../../csdl/annotationExpression/CsdlAnnotationExpression'); const EdmAnnotationExpression = require('./EdmAnnotationExpression'); const IllegalArgumentError = require('../../errors/IllegalArgumentError'); /** * * <a href="./../ODataSpecification/odata-v4.0-errata03-os/complete/part3-csdl/odata-v4.0-errata03-os-part3-csdl-complete.html#_Toc453752656"> * OData CSDL # 14.5.10 Expression edm:Null * </a> * * @extends EdmAnnotationExpression * @hideconstructor */ class EdmNullExpression extends EdmAnnotationExpression { /** * @param {Edm} edm The edm itself * @param {CsdlNullExpression} expression */ constructor(edm, expression) { if (!edm) { throw IllegalArgumentError.createForIllegalInstance('edm', 'Edm'); } if (!expression) { throw IllegalArgumentError.createForIllegalInstance('expression', 'CsdlNullExpression'); } super(CsdlAnnotationExpression.kinds.Null); this._edm = edm; this._expression = expression; /** * @type {EdmAnnotation[]} * @private */ this._annotations = null; } /** * Returns the annotations for this isOf expression * * @returns {EdmAnnotation[]} */ getAnnotations() { if (this._annotations) { return this._annotations; } this._annotations = []; for (let item of this._expression.annotations) { this._annotations.push(AnnotationFactory.createAnnotation(this._edm, item)); } return this._annotations; } } module.exports = EdmNullExpression;