##// END OF EJS Templates
working on lifetime management
working on lifetime management

File last commit:

r129:c13384c6c1ac ioc ts support
r129:c13384c6c1ac ioc ts support
Show More
AggregateDescriptor.ts
40 lines | 1.0 KiB | video/mp2t | TypeScriptLexer
/ src / main / ts / di / AggregateDescriptor.ts
cin
configuration interfaces moved to di/Configuration module...
r118 import { Descriptor } from "./interfaces";
cin
changed the project structure
r49 import { ActivationContext } from "./ActivationContext";
import { isPrimitive } from "../safe";
cin
configuration interfaces moved to di/Configuration module...
r118 import { isDescriptor } from "./traits";
cin
changed the project structure
r49
cin
improved interfaces and more tight type checking
r120 export class AggregateDescriptor<S extends object, T> implements Descriptor<S, T> {
cin
configuration interfaces moved to di/Configuration module...
r118 _value: any;
cin
changed the project structure
r49
cin
configuration interfaces moved to di/Configuration module...
r118 constructor(value: any) {
cin
changed the project structure
r49 this._value = value;
}
cin
configuration interfaces moved to di/Configuration module...
r118 activate(context: ActivationContext<S>): T {
cin
changed the project structure
r49 return this._parse(this._value, context, "$value");
}
cin
configuration interfaces moved to di/Configuration module...
r118 _parse(value: any, context: ActivationContext<S>, path: string): any {
cin
changed the project structure
r49 if (isPrimitive(value))
cin
working on IoC configuration
r114 return value as any;
cin
changed the project structure
r49
if (isDescriptor(value))
return context.activate(value, path);
if (value instanceof Array)
cin
working on IoC configuration
r114 return value.map((x, i) => this._parse(x, context, `${path}[${i}]`)) as any;
cin
changed the project structure
r49
cin
working on IoC configuration
r114 const t: any = {};
for (const p in value)
cin
changed the project structure
r49 t[p] = this._parse(value[p], context, `${path}.${p}`);
return t;
}
toString() {
return "@walk";
}
cin
working on lifetime management
r129
clone() {
return this;
}
cin
changed the project structure
r49 }