@itwin/ecschema-metadata
Version:
ECObjects core concepts in typescript
50 lines • 1.96 kB
JavaScript
;
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module Metadata
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.MutableUnitSystem = exports.UnitSystem = void 0;
const ECObjects_1 = require("../ECObjects");
const Exception_1 = require("../Exception");
const SchemaItem_1 = require("./SchemaItem");
/**
* @public @preview
*/
class UnitSystem extends SchemaItem_1.SchemaItem {
schemaItemType = UnitSystem.schemaItemType;
/** @internal */
static get schemaItemType() { return ECObjects_1.SchemaItemType.UnitSystem; }
/**
* Type guard to check if the SchemaItem is of type UnitSystem.
* @param item The SchemaItem to check.
* @returns True if the item is a UnitSystem, false otherwise.
*/
static isUnitSystem(item) {
if (item && item.schemaItemType === ECObjects_1.SchemaItemType.UnitSystem)
return true;
return false;
}
/**
* Type assertion to check if the SchemaItem is of type UnitSystem.
* @param item The SchemaItem to check.
* @returns The item cast to UnitSystem if it is a UnitSystem, undefined otherwise.
* @internal
*/
static assertIsUnitSystem(item) {
if (!this.isUnitSystem(item))
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaItemType, `Expected '${ECObjects_1.SchemaItemType.UnitSystem}' (UnitSystem)`);
}
}
exports.UnitSystem = UnitSystem;
/**
* @internal
* Used for schema editing.
*/
class MutableUnitSystem extends UnitSystem {
}
exports.MutableUnitSystem = MutableUnitSystem;
//# sourceMappingURL=UnitSystem.js.map