Class: abstract ResolverBinding<V>
Class: abstract
ResolverBinding<V>
Class representing a ResolverBinding.
This class extends the Binding class, using a resolver function to lazily resolve the value when needed.
Author
Mr. Stone evensstone@gmail.com
Extends
Binding
<V
>
Extended by
Type Parameters
V
V
extends BindingValue
The type of value that this binding holds.
Constructors
Constructor
new ResolverBinding<V>(resolver): ResolverBinding<V>;
Create a new instance of ResolverBinding.
Parameters
resolver
Resolver
<V
>
The resolver function to provide the binding value.
Returns
ResolverBinding
<V
>
Throws
ContainerError if the resolver is not a function.
Overrides
Properties
resolver
protected readonly resolver: Resolver<V>;
The resolver function used to provide the binding value.
This function will be called when the value is needed, allowing for lazy instantiation and dependency resolution. It should return an instance of type V
.
value?
protected optional value: V;
The value held by the binding.
This value is resolved at runtime, either directly or through a resolver function.
Inherited from
Methods
isResolved()
protected isResolved(): boolean;
Check if the value has been resolved.
Returns
boolean
A boolean indicating whether the value has been resolved.
Inherited from
resolve()
abstract resolve(container): undefined | V;
Resolve and return the value of the binding.
This abstract method must be implemented by subclasses to provide specific resolution logic.
Parameters
container
The container to resolve dependencies from.
Returns
undefined
| V
The resolved value of the binding.