tsioc
Version:
tsioc is AOP, Ioc container, via typescript decorator
75 lines (74 loc) • 3.16 kB
TypeScript
import { LifeScope, DecorSummary } from '../LifeScope';
import { Type, Express } from '../types';
import { MethodMetadata } from './metadatas/index';
import { IContainer } from '../IContainer';
import { ActionComponent } from './actions/index';
import { DecoratorType } from './factories/index';
import { ActionData } from './ActionData';
import { IParameter } from '../IParameter';
export declare class DefaultLifeScope implements LifeScope {
private container;
decorators: DecorSummary[];
action: ActionComponent;
constructor(container: IContainer);
addAction(action: ActionComponent, type: DecoratorType, ...nodepaths: string[]): this;
registerDecorator(decorator: Function, ...actions: string[]): this;
registerCustomDecorator(decorator: Function, type: DecoratorType, ...actions: string[]): this;
execute<T>(type: DecoratorType, data: ActionData<T>, ...names: string[]): void;
getClassDecorators(match?: Express<DecorSummary, boolean>): DecorSummary[];
getMethodDecorators(match?: Express<DecorSummary, boolean>): DecorSummary[];
getPropertyDecorators(match?: Express<DecorSummary, boolean>): DecorSummary[];
getParameterDecorators(match?: Express<DecorSummary, boolean>): DecorSummary[];
getDecoratorType(decirator: any): DecoratorType;
/**
* is vaildate dependence type or not. dependence type must with class decorator.
*
* @template T
* @param {Type<T>} target
* @returns {boolean}
* @memberof Container
*/
isVaildDependence<T>(target: Type<T>): boolean;
getAtionByName(name: string): ActionComponent;
getClassAction(): ActionComponent;
getMethodAction(): ActionComponent;
getPropertyAction(): ActionComponent;
getParameterAction(): ActionComponent;
/**
* get constructor parameters metadata.
*
* @template T
* @param {Type<T>} type
* @returns {IParameter[]}
* @memberof IContainer
*/
getConstructorParameters<T>(type: Type<T>): IParameter[];
/**
* get method params metadata.
*
* @template T
* @param {Type<T>} type
* @param {T} instance
* @param {(string | symbol)} propertyKey
* @returns {IParameter[]}
* @memberof IContainer
*/
getMethodParameters<T>(type: Type<T>, instance: T, propertyKey: string | symbol): IParameter[];
/**
* get paramerter names.
*
* @template T
* @param {Type<T>} type
* @param {(string | symbol)} propertyKey
* @returns {string[]}
* @memberof DefaultLifeScope
*/
getParamerterNames<T>(type: Type<T>, propertyKey: string | symbol): string[];
isSingletonType<T>(type: Type<T>): boolean;
getMethodMetadatas<T>(type: Type<T>, propertyKey: string | symbol): MethodMetadata[];
filerDecorators(express?: Express<DecorSummary, boolean>): DecorSummary[];
protected getParameters<T>(type: Type<T>, instance?: T, propertyKey?: string | symbol): IParameter[];
protected getTypeDecorators(decType: string, match?: Express<DecorSummary, boolean>): DecorSummary[];
protected buildAction(): void;
protected toActionType(type: DecoratorType): string;
}