Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 11x 11x 11x 6x 11x 11x 1x 11x 2x 11x 5x 11x 4x | import { MetadataRegistry } from "./MetadataRegistry";
/**
* Interface for a registry provider
*/
export interface IRegistryProvider {
getRegistry(): MetadataRegistry;
}
/**
* Default registry provider that uses a shared registry instance
*
* Note: This no longer uses a singleton pattern via static getInstance(),
* but provides a shared instance through the provider pattern.
*/
export class DefaultRegistryProvider implements IRegistryProvider {
private static sharedRegistry: MetadataRegistry = new MetadataRegistry();
getRegistry(): MetadataRegistry {
return DefaultRegistryProvider.sharedRegistry;
}
}
/**
* Global registry provider instance - can be replaced for testing
*/
let globalRegistryProvider: IRegistryProvider = new DefaultRegistryProvider();
/**
* Get the current registry provider
*/
export function getRegistryProvider(): IRegistryProvider {
return globalRegistryProvider;
}
/**
* Set a new registry provider
* @param provider The registry provider to use
*/
export function setRegistryProvider(provider: IRegistryProvider): void {
globalRegistryProvider = provider;
}
/**
* Reset to the default registry provider
*/
export function resetRegistryProvider(): void {
globalRegistryProvider = new DefaultRegistryProvider();
}
/**
* Get the current registry instance
*
* This provides backward compatibility with existing code,
* but new code should prefer explicit dependency injection
* via constructors when possible.
*/
export function getRegistry(): MetadataRegistry {
return globalRegistryProvider.getRegistry();
} |