UNPKG

@sap/odata-v4

Version:

OData V4.0 server library

62 lines (52 loc) 1.79 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#_Toc453752651"> * OData CSDL # 14.5.5 Expression edm:Collection * </a> * * @extends EdmAnnotationExpression * @hideconstructor */ class EdmCollectionExpression extends EdmAnnotationExpression { /** * @param {Edm} edm The edm itself * @param {CsdlCollectionExpression} collection */ constructor(edm, collection) { if (!edm) { throw IllegalArgumentError.createForIllegalInstance('edm', 'Edm'); } if (!collection) { throw IllegalArgumentError.createForIllegalInstance('collection', 'CsdlCollectionExpression'); } super(CsdlAnnotationExpression.kinds.Collection); /** * @type {Edm} * @private */ this._edm = edm; /** * @type {EdmAnnotationExpression[]} * @private */ this._expressions = []; for (let item of collection.expressions) { const element = AnnotationFactory.createEdmExpressionFromCsdlExpression(this._edm, item); this._expressions.push(element); } } /** * Return the expressions which make up the collection * * @returns {EdmAnnotationExpression[]} */ getExpressions() { return this._expressions; } } module.exports = EdmCollectionExpression;