@dolittle/sdk.artifacts
Version:
Dolittle is a decentralized, distributed, event-driven microservice platform built to harness the power of events.
39 lines • 1.55 kB
TypeScript
import { Constructor } from '@dolittle/types';
import { DecomposedKey } from './ComplexValueMap';
import { ITypeMap } from './ITypeMap';
/**
* Represents a system for associating complex valued keys to a type.
* @template K The type of the key.
* @template D The type of the decomposed complex key type.
*/
export declare class TypeMap<K, D extends DecomposedKey> extends ITypeMap<K> {
private readonly _keyType;
private readonly _keysToTypes;
private readonly _typesToKeys;
/**
* Initialises a new instance of the {@link TypeMap} class.
* @param {Constructor} _keyType - The type of the complex valued key.
* @param {(K) => D} decomposer - The callback to use for decomposing the complex valye key to primitive types.
* @param {number} depth - The length of a decomposed key.
*/
constructor(_keyType: Constructor<K>, decomposer: (key: K) => D, depth: D['length']);
/** @inheritdoc */
hasFor(type: Constructor<any>): boolean;
/** @inheritdoc */
getFor(type: Constructor<any>): K;
/** @inheritdoc */
getAll(): K[];
/** @inheritdoc */
hasTypeFor(key: K): boolean;
/** @inheritdoc */
getTypeFor(key: K): Constructor<any>;
/** @inheritdoc */
getAllTypes(): Constructor<any>[];
/** @inheritdoc */
resolveFrom(object: any, input?: K): K;
/** @inheritdoc */
associate(type: Constructor<any>, key: K): void;
private throwIfTypeAlreadyAssociatedWithKey;
private throwIfKeyAlreadyAssociatedWithType;
}
//# sourceMappingURL=TypeMap.d.ts.map