A generic mutable implementation of the IContextLookup interface that helps in building IContextLookup and ILookup implementations.
Implements
Inheritance Hierarchy
- CContextLookup<TDecoratedType>
Remarks
Use this class to build an ILookup or IContextLookup implementation.
This class can be used in the context where an ILookupDecorator interface implementation is needed. It serves as a store for a chain of IContextLookupChainLinks for a single given type, which is represented by TDecoratedType.
Use the getDecoratorFor<TDecoratedType> method to get access to a convenient set of functionality to modify the behavior of this instance.
Type Parameters
TDecoratedType
- The type of the context objects this instance will be used for.
Members
Show:
Constructors
Methods
Adds an IContextLookupChainLink to this instance's managed chain of links.
Adds an IContextLookupChainLink to this instance's managed chain of links.
final
Parameters
- link: IContextLookupChainLink
- The link to add.
Tries to create or retrieve an implementation of the given type for a given item.
Tries to create or retrieve an implementation of the given type for a given item.
final
Parameters
- item: any
- the item to look up a type for
- type: Constructor
- the type to look up
Return Value
- Object | null
- an implementation or
null
See Also
API
- lookup
Implements
IContextLookup.contextLookupgetDecoratorFor
<TInterface> (interfaceType: Constructor<TInterface>): LookupDecorator<TDecoratedType, TInterface>Gets a LookupDecorator<TDecoratedType, TInterface> for the given interface type that uses this instance as the backing store.
getDecoratorFor
<TInterface> (interfaceType: Constructor<TInterface>): LookupDecorator<TDecoratedType, TInterface>Gets a LookupDecorator<TDecoratedType, TInterface> for the given interface type that uses this instance as the backing store.
Use this decorator to add more functionality to this instance's lookup<TDecoratedType> behavior.
final
Type Parameters
TInterface
Parameters
- interfaceType: Constructor<TInterface>
Return Value
- LookupDecorator<TDecoratedType, TInterface>
- A readily configured instance for decorating the
TInterfacetype that uses this instance as the backing store.
Typesafe-variant of the IContextLookup.contextLookup implementation.
Typesafe-variant of the IContextLookup.contextLookup implementation.
This implementation is the same as IContextLookup.contextLookup except that it ensures that the first parameter is of the matching type.
final
Parameters
- item: TDecoratedType
- The item to look up the implementation for.
- type: Constructor
- The type of the implementation to look up.
Return Value
- any | null
- The implementation or
null
Removes an IContextLookupChainLink from this instance's managed chain of links.
Removes an IContextLookupChainLink from this instance's managed chain of links.
final
Parameters
- link: IContextLookupChainLink
- The link to remove.