@eclipse-scout/core
Version:
Eclipse Scout runtime
38 lines • 2.47 kB
TypeScript
import { Constructor, DoValueMetaData, InitModelOf, ObjectModel, ObjectWithType, Predicate } from '../../index';
export declare class DataObjectDeserializer implements DataObjectDeserializerModel, ObjectWithType {
model: DataObjectDeserializerModel;
protected static _TYPE_VERSION_ATTRIBUTE_NAME: string;
id: string;
objectType: string;
createPojoIfDoIsUnknown: boolean;
retainTypeVersion: Predicate<object>;
constructor(model?: InitModelOf<DataObjectDeserializer>);
deserialize<T extends object>(value: any, valueMetaData?: DoValueMetaData<T>): T;
protected _deserializeObject<T extends object>(rawObj: Record<string, any>, metaData?: DoValueMetaData<T>): T;
protected _resolveDataObjectType(rawObj: Record<string, any>, metaData?: DoValueMetaData): Constructor;
protected _createResultObject<T extends object>(constructor: Constructor<T>): T;
protected _convertFieldValue(proto: object, rawObj: object, key: string, value: any): any;
}
export interface DataObjectDeserializerModel extends ObjectModel<DataObjectDeserializer> {
/**
* Controls the kind of object that will be created when deserializing unknown DataObjects.
* If `true` a pojo will be created for unknown DOs. If `false`, instances of {@link BaseDoEntity} will be created.
* Changing the type of the deserialized DataObject may change the deserialization behaviour of the property '_typeVersion' (see {@link retainTypeVersion} for more details).
* Default is `false`.
*
* A DataObject can be unknown e.g. if:
* <ol>
* <li>The _type attribute of the object to deserialize cannot be found in TS.</li>
* <li>There is no _type attribute and the TypeScript attribute declaration (metadata) does not provide a class type which could be used as fallback.</li>
* </ol>
*/
createPojoIfDoIsUnknown?: boolean;
/**
* Controls whether the '_typeVersion' property is retained when deserializing DataObjects.
* The property can be given as a {@link boolean} or a {@link Predicate}, whose input is the deserialized DataObject.
* If `true`, the '_typeVersion' will be set on the deserialized DataObject. If `false`, it will be ignored.
* Default is a {@link Predicate} that ignores the '_typeVersion' if the deserialized DataObject is instance of {@link BaseDoEntity}.
*/
retainTypeVersion?: boolean | Predicate<object>;
}
//# sourceMappingURL=DataObjectDeserializer.d.ts.map