new AdapterRegistry()
The registry of adapter. It maintains a mapping between names and adapters.
This class is not a singleton. Each instance is independent, which allows for isolated testing and different configurations depending on the evaluation context.
Source
Members
_adaptersMap.<string, QueryAdapter>
Field to reference all registered QueryAdapter's.
Type
-
Map.<string, QueryAdapter>
Source
Methods
get(name) → {QueryAdapter}
It gets a previously registered QueryAdapter by its name; otherwise, an AdapterError is raised, informing the list of available adapters' names.
Parameters
-
name
stringThe name of the QueryAdapter being searched for.
Returns
-
QueryAdapterPreviously registered QueryAdapter; otherwise, an AdapterError exception will be raised.
Throws
-
Whenever no QueryAdapter with
namewere previously registered in this AdapterRegistry instance.
Source
has(name) → {boolean}
It tests if a QueryAdapter has been registered with such 'name' in this AdapterRegistry instance.
Parameters
-
name
stringThe name of the QueryAdapter being searched for.
Returns
-
booleantruewhenever a registered QueryAdapter with such 'name' is found in this AdapterRegistry;falseotherwise.
Source
names() → {Array.<string>}
It returns a list with the 'name's of all previously registered QueryAdapters.
Returns
-
Array.<string>An array of strings with the 'name's of all QueryAdapter registered in this AdapterRegistry instance; if no QueryAdapter has been registered, an empty array will be returned.
Source
register(adapter)
It registers a new QueryAdapter.
Parameters
-
adapter
module:jm2mp/adapters/registry.QueryAdapterThe QueryAdapter to be registered.
Throws
-
It throws an AdapterError if there is a previously registered QueryAdapter with the same
name, and also if the specifiedadapterdoes not comply with the required interface (contract).