You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB

4 years ago
import {Collection} from '../../../lib/src/collection/Collection.ts'
import {DependencyRequirement} from '../type/DependencyRequirement.ts'
4 years ago
/**
* Abstract base class for dependency container factories.
* @abstract
*/
4 years ago
export default abstract class AbstractFactory {
protected constructor(
4 years ago
/**
* Token that was registered for this factory. In most cases, this is the static
* form of the item that is to be produced by this factory.
* @var
* @protected
*/
4 years ago
protected token: any
) {}
4 years ago
/**
* Produce an instance of the token.
* @param {Array} dependencies - the resolved dependencies, in order
* @param {Array} parameters - the bound constructor parameters, in order
*/
4 years ago
abstract produce(dependencies: any[], parameters: any[]): any
4 years ago
/**
* Should return true if the given identifier matches the token for this factory.
* @param something
* @return boolean
*/
4 years ago
abstract match(something: any): boolean
4 years ago
/**
* Get the dependency requirements required by this factory's token.
* @return Collection<DependencyRequirement>
*/
4 years ago
abstract get_dependency_keys(): Collection<DependencyRequirement>
}