@itwin/ecschema-metadata
Version:
ECObjects core concepts in typescript
107 lines • 4.55 kB
TypeScript
/** @packageDocumentation
* @module Metadata
*/
import { EntityClassProps } from "../Deserialization/JsonProps";
import { SchemaItemType, StrengthDirection } from "../ECObjects";
import { HasMixins, LazyLoadedMixin } from "../Interfaces";
import { ECClass } from "./Class";
import { Mixin } from "./Mixin";
import { AnyProperty, NavigationProperty, Property } from "./Property";
import { RelationshipClass } from "./RelationshipClass";
import { SchemaItem } from "./SchemaItem";
/**
* A Typescript class representation of an ECEntityClass.
* @public @preview
*/
export declare class EntityClass extends ECClass implements HasMixins {
readonly schemaItemType: SchemaItemType;
/** @internal */
static get schemaItemType(): SchemaItemType;
private _mixins?;
get mixins(): ReadonlyArray<LazyLoadedMixin>;
getMixinsSync(): Iterable<Mixin>;
/**
*
* @param mixin
* @internal
*/
protected addMixin(mixin: Mixin): void;
/**
* Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.
* @param name The name of the property to find.
*/
getInheritedProperty(name: string): Promise<AnyProperty | undefined>;
/**
* Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.
* @param name The name of the property to find.
*/
getInheritedPropertySync(name: string): Property | undefined;
/**
*
* @param cache
* @returns
*
* @internal
*/
protected buildPropertyCache(): Promise<Map<string, Property>>;
/**
*
* @param cache
* @internal
*/
protected buildPropertyCacheSync(): Map<string, Property>;
/**
*
* @param name
* @param relationship
* @param direction
* @internal
*/
protected createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;
/**
*
* @param name
* @param relationship
* @param direction
* @internal
*/
protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;
/**
* Save this EntityClass' properties to an object for serializing to JSON.
* @param standalone Serialization includes only this object (as opposed to the full schema).
* @param includeSchemaVersion Include the Schema's version information in the serialized object.
*/
toJSON(standalone?: boolean, includeSchemaVersion?: boolean): EntityClassProps;
/** @internal */
toXml(schemaXml: Document): Promise<Element>;
fromJSON(entityClassProps: EntityClassProps): Promise<void>;
fromJSONSync(entityClassProps: EntityClassProps): void;
/**
* Type guard to check if the SchemaItem is of type EntityClass.
* @param item The SchemaItem to check.
* @returns True if the item is an EntityClass, false otherwise.
*/
static isEntityClass(item?: SchemaItem): item is EntityClass;
/**
* Type assertion to check if the SchemaItem is of type EntityClass.
* @param item The SchemaItem to check.
* @returns The item cast to EntityClass if it is an EntityClass, undefined otherwise.
* @internal
*/
static assertIsEntityClass(item?: SchemaItem): asserts item is EntityClass;
}
/**
* Hackish approach that works like a "friend class" so we can access protected members without making them public.
* @internal
*/
export declare abstract class MutableEntityClass extends EntityClass {
abstract addMixin(mixin: Mixin): any;
abstract createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;
abstract createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;
abstract setDisplayLabel(displayLabel: string): void;
}
/** @internal */
export declare function createNavigationProperty(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;
/** @internal */
export declare function createNavigationPropertySync(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;
//# sourceMappingURL=EntityClass.d.ts.map