import { ObjectPool } from './ObjectPool' ; ignore const poolMap = new Map ( ) ; class public example export class ObjectPoolFactory { param classConstructor static build < T > ( Type ) { let pool = poolMap . get ( Type ) ; if ( pool ) { return pool ; } pool = new ( class DefaultObjectPool extends ObjectPool < any > { create ( ) { return new Type ( ) ; } } ) ( ) ; poolMap . set ( Type , pool ) ; return pool ; } param factoryFunction static buildFunctional < T > ( factoryFunction ) { return new ( class DefaultObjectPool extends ObjectPool < T > { create = factoryFunction ; } ) ( ) ; } }