@itwin/ecschema-metadata
Version:
ECObjects core concepts in typescript
273 lines • 10.8 kB
TypeScript
/** @packageDocumentation
* @module Metadata
*/
import { EnumerationPropertyProps, NavigationPropertyProps, PrimitiveArrayPropertyProps, PrimitiveOrEnumPropertyBaseProps, PrimitivePropertyProps, PropertyProps, StructPropertyProps } from "../Deserialization/JsonProps";
import { PrimitiveType, StrengthDirection } from "../ECObjects";
import { AnyClass, LazyLoadedEnumeration, LazyLoadedKindOfQuantity, LazyLoadedPropertyCategory, LazyLoadedRelationshipClass } from "../Interfaces";
import { PropertyType } from "../PropertyTypes";
import { ECName } from "../ECName";
import { ECClass, StructClass } from "./Class";
import { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet } from "./CustomAttribute";
import { KindOfQuantity } from "./KindOfQuantity";
import { PropertyCategory } from "./PropertyCategory";
import { type RelationshipClass } from "./RelationshipClass";
import { Schema } from "./Schema";
/**
* A common abstract class for all ECProperty types.
* @public @preview
*/
export declare abstract class Property implements CustomAttributeContainerProps {
private _name;
private _class;
private _description?;
private _label?;
private _isReadOnly?;
private _priority?;
private _category?;
private _kindOfQuantity?;
private _customAttributes?;
/** @internal */
protected _type: PropertyType;
/** @internal */
constructor(ecClass: ECClass, name: string, type: PropertyType);
isArray(): this is AnyArrayProperty;
isPrimitive(): this is AnyPrimitiveProperty;
isStruct(): this is AnyStructProperty;
isEnumeration(): this is AnyEnumerationProperty;
isNavigation(): this is NavigationProperty;
get name(): string;
get class(): AnyClass;
get label(): string | undefined;
get description(): string | undefined;
get isReadOnly(): boolean;
get priority(): number;
get category(): LazyLoadedPropertyCategory | undefined;
get kindOfQuantity(): LazyLoadedKindOfQuantity | undefined;
get propertyType(): PropertyType;
get customAttributes(): CustomAttributeSet | undefined;
/** Returns the name in the format 'ClassName.PropertyName'. */
get fullName(): string;
/** Returns the schema of the class holding the property. */
get schema(): Schema;
getCategorySync(): PropertyCategory | undefined;
getKindOfQuantitySync(): KindOfQuantity | undefined;
/**
* Save this Property's properties to an object for serializing to JSON.
*/
toJSON(): PropertyProps;
/** @internal */
toXml(schemaXml: Document): Promise<Element>;
fromJSONSync(propertyProps: PropertyProps): void;
fromJSON(propertyProps: PropertyProps): Promise<void>;
/** @internal */
protected addCustomAttribute(customAttribute: CustomAttribute): void;
/** @internal */
protected setName(name: ECName): void;
/**
* @internal Used in schema editing.
*/
protected setDescription(description: string): void;
/**
* @internal Used in schema editing.
*/
protected setLabel(label: string): void;
/**
* @internal Used in schema editing.
*/
protected setIsReadOnly(isReadOnly: boolean): void;
/**
* @internal Used in schema editing.
*/
protected setPriority(priority: number): void;
/**
* @internal Used in schema editing.
*/
protected setCategory(category: LazyLoadedPropertyCategory): void;
/**
* @internal Used in schema editing.
*/
protected setKindOfQuantity(kindOfQuantity: LazyLoadedKindOfQuantity): void;
/**
* Retrieve all custom attributes in the current property and its base
* This is the async version of getCustomAttributesSync()
*/
getCustomAttributes(): Promise<CustomAttributeSet>;
/**
* Retrieve all custom attributes in the current property and its base.
*/
getCustomAttributesSync(): CustomAttributeSet;
/**
* @internal
*/
static isProperty(object: any): object is AnyProperty;
}
/** @public @preview */
export declare abstract class PrimitiveOrEnumPropertyBase extends Property {
/** @internal */
protected _extendedTypeName?: string;
/** @internal */
protected _minLength?: number;
/** @internal */
protected _maxLength?: number;
/** @internal */
protected _minValue?: number;
/** @internal */
protected _maxValue?: number;
get extendedTypeName(): string | undefined;
get minLength(): number | undefined;
get maxLength(): number | undefined;
get minValue(): number | undefined;
get maxValue(): number | undefined;
/** @internal */
constructor(ecClass: ECClass, name: string, type: PropertyType);
/**
* Save this PrimitiveOrEnumPropertyBase's properties to an object for serializing to JSON.
*/
toJSON(): PrimitiveOrEnumPropertyBaseProps;
/** @internal */
toXml(schemaXml: Document): Promise<Element>;
fromJSONSync(propertyBaseProps: PrimitiveOrEnumPropertyBaseProps): void;
/**
* @internal Used in schema editing.
*/
protected setExtendedTypeName(extendedTypeName: string): void;
/**
* @internal Used in schema editing.
*/
protected setMinLength(minLength: number): void;
/**
* @internal Used in schema editing.
*/
protected setMaxLength(maxLength: number): void;
/**
* @internal Used in schema editing.
*/
protected setMinValue(minValue: number): void;
/**
* @internal Used in schema editing.
*/
protected setMaxValue(maxValue: number): void;
fromJSON(propertyBaseProps: PrimitiveOrEnumPropertyBaseProps): Promise<void>;
}
/** @public @preview */
export declare class PrimitiveProperty extends PrimitiveOrEnumPropertyBase {
get primitiveType(): PrimitiveType;
/** @internal */
constructor(ecClass: ECClass, name: string, primitiveType?: PrimitiveType);
fromJSONSync(primitivePropertyProps: PrimitivePropertyProps): void;
fromJSON(primitivePropertyProps: PrimitivePropertyProps): Promise<void>;
/**
* Save this PrimitiveProperty's properties to an object for serializing to JSON.
*/
toJSON(): PrimitivePropertyProps;
/** @internal */
toXml(schemaXml: Document): Promise<Element>;
}
/** @public @preview */
export declare class EnumerationProperty extends PrimitiveOrEnumPropertyBase {
/** @internal */
protected _enumeration?: LazyLoadedEnumeration;
get enumeration(): LazyLoadedEnumeration | undefined;
/**
* Save this EnumerationProperty's properties to an object for serializing to JSON.
*/
toJSON(): EnumerationPropertyProps;
/** @internal */
constructor(ecClass: ECClass, name: string, type: LazyLoadedEnumeration);
fromJSONSync(enumerationPropertyProps: EnumerationPropertyProps): void;
/** @internal */
toXml(schemaXml: Document): Promise<Element>;
fromJSON(enumerationPropertyProps: EnumerationPropertyProps): Promise<void>;
}
/** @public @preview */
export declare class StructProperty extends Property {
/** @internal */
protected _structClass: StructClass;
get structClass(): StructClass;
/** @internal */
constructor(ecClass: ECClass, name: string, type: StructClass);
/**
* Save this StructProperty's properties to an object for serializing to JSON.
*/
toJSON(): StructPropertyProps;
/** @internal */
toXml(schemaXml: Document): Promise<Element>;
fromJSONSync(structPropertyProps: StructPropertyProps): void;
fromJSON(structPropertyProps: StructPropertyProps): Promise<void>;
}
/** @public @preview */
export declare class NavigationProperty extends Property {
/** @internal */
protected _relationshipClass: LazyLoadedRelationshipClass;
/** @internal */
protected _direction: StrengthDirection;
get relationshipClass(): LazyLoadedRelationshipClass;
getRelationshipClassSync(): RelationshipClass | undefined;
get direction(): StrengthDirection;
/**
* Save this NavigationProperty's properties to an object for serializing to JSON.
*/
toJSON(): NavigationPropertyProps;
/** @internal */
toXml(schemaXml: Document): Promise<Element>;
/** @internal */
constructor(ecClass: ECClass, name: string, relationship: LazyLoadedRelationshipClass, direction?: StrengthDirection);
}
type Constructor<T> = new (...args: any[]) => T;
/** @public @preview */
export declare abstract class ArrayProperty extends Property {
/** @internal */
protected _minOccurs: number;
/** @internal */
protected _maxOccurs?: number;
get minOccurs(): number;
get maxOccurs(): number | undefined;
/**
* @internal Used in schema editing.
*/
protected setMinOccurs(minOccurs: number): void;
/**
* @internal Used in schema editing.
*/
protected setMaxOccurs(maxOccurs: number): void;
}
declare const PrimitiveArrayProperty_base: typeof PrimitiveProperty & Constructor<ArrayProperty>;
/** @public @preview */
export declare class PrimitiveArrayProperty extends PrimitiveArrayProperty_base {
/** @internal */
constructor(ecClass: ECClass, name: string, primitiveType?: PrimitiveType);
/**
* Save this PrimitiveArrayProperty's properties to an object for serializing to JSON.
*/
toJSON(): PrimitiveArrayPropertyProps;
}
declare const EnumerationArrayProperty_base: typeof EnumerationProperty & Constructor<ArrayProperty>;
/** @public @preview */
export declare class EnumerationArrayProperty extends EnumerationArrayProperty_base {
constructor(ecClass: ECClass, name: string, type: LazyLoadedEnumeration);
}
declare const StructArrayProperty_base: typeof StructProperty & Constructor<ArrayProperty>;
/** @public @preview */
export declare class StructArrayProperty extends StructArrayProperty_base {
/** @internal */
constructor(ecClass: ECClass, name: string, type: StructClass);
}
/** @public @preview */
export type AnyArrayProperty = PrimitiveArrayProperty | EnumerationArrayProperty | StructArrayProperty;
/** @public @preview */
export type AnyPrimitiveProperty = PrimitiveProperty | PrimitiveArrayProperty;
/** @public @preview */
export type AnyEnumerationProperty = EnumerationProperty | EnumerationArrayProperty;
/** @public @preview */
export type AnyStructProperty = StructProperty | StructArrayProperty;
/** @public @preview */
export type AnyProperty = AnyPrimitiveProperty | AnyEnumerationProperty | AnyStructProperty | NavigationProperty;
/**
* Hackish approach that works like a "friend class" so we can access protected members without making them public.
* @internal
*/
export declare abstract class MutableProperty extends Property {
abstract addCustomAttribute(customAttribute: CustomAttribute): void;
}
export {};
//# sourceMappingURL=Property.d.ts.map