import { Constructor, ObjectType } from '../index'; /** * Represents an ordered collection of instances of the specified object type. These are created automatically * on first access and are stored in the registry indefinitely or until explicitly unregistered. * * The object registry can be used as an extension point for other application modules. It allows callers * to apply the _inversion of control_ principle, similar to `BEANS.all()` in Java. * * @template TObject The type of objects managed by this registry. */ export declare class ObjectRegistry { static readonly DEFAULT_ORDER = 5000; protected readonly _registrations: ObjectRegistration[]; /** * Registers the given object type with this registry. After registration, the list returned by {@link all} * will include an instance of this type in the order it was registered. The object instance ise created * using {@link scout.create}. The default ordering can be altered by specifying an explicit order. The * default order is {@link DEFAULT_ORDER}. * * @returns An object that can be used to {@link unregister} the object again. */ register(objectType: Constructor, options?: number | ObjectRegistryRegisterOptions): ObjectRegistration; protected _prepareOptions(options?: number | ObjectRegistryRegisterOptions): ObjectRegistryRegisterOptions; protected _createRegistration(objectType: Constructor, options: ObjectRegistryRegisterOptions): ObjectRegistration; /** * Unregisters a previously registered object. * * @param registration The registration handle that was returned by {@link register}. * @return true if the registration was removed, false otherwise. */ unregister(registration: ObjectRegistration): boolean; /** * @returns All registered objects in the order specified during registration. */ all(): TObject[]; } export interface ObjectRegistryRegisterOptions { /** * Default is {@link ObjectRegistry.DEFAULT_ORDER}. */ order?: number; } /** * Registration handle of an object in an {@link ObjectFactory}. Can be used to unregister the object again. */ export interface ObjectRegistration { objectType: ObjectType; instance: TObject; order: number; } export declare class ObjectRegistries { protected static readonly _INSTANCES: Map, ObjectRegistry>; /** * @returns a singleton instance of the given {@link ObjectFactory} class. */ static get>(registryType: Constructor): TRegistry; } //# sourceMappingURL=ObjectRegistry.d.ts.map