import { ControllerClass } from "./controller-metadata.ts" ; import { Type } from "./deps.ts" ; import { ValueProvider } from "./value-provider.ts" ; export class ValueProviderCatalog { private static readonly catalog = new Map < Type , { actions : { [ action ] : { valueProviders : ValueProvider [ ] ; } ; } ; } > ( ) ; static registerValueProvider ( type , action , parameterIndex , valueProvider ) { let controllerRegistration = this . catalog . get ( type ) ; if ( ! controllerRegistration ) { controllerRegistration = { actions : { } } ; this . catalog . set ( type , controllerRegistration ) ; } let actionRegistration = controllerRegistration . actions [ action ] ; if ( ! actionRegistration ) { actionRegistration = { valueProviders : [ ] } ; controllerRegistration . actions [ action ] = actionRegistration ; } actionRegistration . valueProviders [ parameterIndex ] = valueProvider ; } static getValueProvider ( type , action , parameterIndex ) { return this . catalog . get ( type ) ?. actions [ action ] . valueProviders [ parameterIndex ] ; } }