UNPKG

@eclipse-scout/core

Version:
59 lines 2.96 kB
import { DeepPartial, DoContributionClassOrType, InitModelOf } from '../index'; /** * Base class for all data objects. */ export declare class BaseDoEntity { model: DeepPartial<Omit<this, 'init' | 'getContribution' | 'addContribution' | 'removeContribution' | 'toPojo' | 'clone' | 'equals' | 'model'>>; _type?: string; _contributions?: BaseDoEntity[]; init(model: InitModelOf<this>): void; /** * @see dataObjects.getContribution */ getContribution<TContributionDo extends BaseDoEntity>(contributionClassOrType: DoContributionClassOrType<TContributionDo>): TContributionDo; /** * @see dataObjects.getContributions */ getContributions<TContributionDo extends BaseDoEntity>(): TContributionDo[]; /** * @see dataObjects.addContribution */ addContribution(contribution: BaseDoEntity): void; /** * @see dataObjects.removeContribution */ removeContribution<TContributionDo extends BaseDoEntity>(contributionClassOrType: DoContributionClassOrType<TContributionDo>): boolean; /** * Converts this data object instance to a pojo. * * See {@link dataObjects.serialize} for details. * * @returns this instance converted to a pojo. */ toPojo(): object; /** * Creates a deep clone of this data object by serializing and deserializing this instance. * * In most cases the result will be equal to this instance. However, there are some exceptions: * * If you pass an extra model to apply to this function. * * If this data object contains Maps having keys that are unique for the Map implementation, but are no longer unique after conversion. * One example are {@link Date} instances: While two different instances with the same date value may be added to the Map, * it cannot be retained during serialization as it is converted to an object property key (string) which must be unique. * * If this data object contains pojo objects (e.g. Record) with properties having the value 'undefined'. These properties will not be part of the result. * * See {@link dataObjects.serialize} for details. * * @param model An optional model to apply to the clone. * * The values of the model are copied by reference and nested objects are _not_ merged (shallow-copy). * * The model is applied to the pojo representation of this data object before a new instance is created. So to modify properties, the structure and types of the properties in their pojo form must be used. * @returns A deep clone of this data object instance (compare {@link toPojo}). */ clone(model?: InitModelOf<this> | BaseDoEntity): this; /** * Recursively (deep) compares this data object to the given object. * @param obj The object to compare against. * @returns true if the two are deeply equal. */ equals(obj: any): boolean; } //# sourceMappingURL=BaseDoEntity.d.ts.map