2016-06-23 09:47:54 -07:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
2016-08-10 18:21:28 -07:00
|
|
|
import {Type} from '../type';
|
2015-05-18 17:19:54 -07:00
|
|
|
import {PlatformReflectionCapabilities} from './platform_reflection_capabilities';
|
2016-06-08 16:38:52 -07:00
|
|
|
import {GetterFn, MethodFn, SetterFn} from './types';
|
|
|
|
|
2015-05-18 17:19:54 -07:00
|
|
|
export {PlatformReflectionCapabilities} from './platform_reflection_capabilities';
|
2016-06-08 16:38:52 -07:00
|
|
|
export {GetterFn, MethodFn, SetterFn} from './types';
|
|
|
|
|
2015-12-03 15:49:09 -08:00
|
|
|
/**
|
|
|
|
* Provides access to reflection data about symbols. Used internally by Angular
|
|
|
|
* to power dependency injection and compilation.
|
|
|
|
*/
|
2017-05-18 13:46:51 -07:00
|
|
|
export class Reflector {
|
|
|
|
constructor(public reflectionCapabilities: PlatformReflectionCapabilities) {}
|
2015-04-24 13:17:36 -07:00
|
|
|
|
2016-05-04 10:00:59 -07:00
|
|
|
updateCapabilities(caps: PlatformReflectionCapabilities) { this.reflectionCapabilities = caps; }
|
2016-05-03 17:31:40 -07:00
|
|
|
|
2016-10-12 10:05:32 -07:00
|
|
|
factory(type: Type<any>): Function { return this.reflectionCapabilities.factory(type); }
|
2015-04-24 13:17:36 -07:00
|
|
|
|
2016-08-10 18:21:28 -07:00
|
|
|
parameters(typeOrFunc: Type<any>): any[][] {
|
2016-10-06 15:11:16 -07:00
|
|
|
return this.reflectionCapabilities.parameters(typeOrFunc);
|
2015-04-24 13:17:36 -07:00
|
|
|
}
|
|
|
|
|
2016-08-10 18:21:28 -07:00
|
|
|
annotations(typeOrFunc: Type<any>): any[] {
|
2016-10-06 15:11:16 -07:00
|
|
|
return this.reflectionCapabilities.annotations(typeOrFunc);
|
2015-04-24 13:17:36 -07:00
|
|
|
}
|
|
|
|
|
2016-08-10 18:21:28 -07:00
|
|
|
propMetadata(typeOrFunc: Type<any>): {[key: string]: any[]} {
|
2016-10-06 15:11:16 -07:00
|
|
|
return this.reflectionCapabilities.propMetadata(typeOrFunc);
|
2015-09-03 15:10:48 -07:00
|
|
|
}
|
|
|
|
|
2016-10-12 10:05:32 -07:00
|
|
|
hasLifecycleHook(type: any, lcProperty: string): boolean {
|
|
|
|
return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
|
2015-05-27 08:07:11 -07:00
|
|
|
}
|
|
|
|
|
2016-10-12 10:05:32 -07:00
|
|
|
getter(name: string): GetterFn { return this.reflectionCapabilities.getter(name); }
|
2016-05-04 10:00:59 -07:00
|
|
|
|
2016-10-12 10:05:32 -07:00
|
|
|
setter(name: string): SetterFn { return this.reflectionCapabilities.setter(name); }
|
2015-04-24 13:17:36 -07:00
|
|
|
|
2016-10-12 10:05:32 -07:00
|
|
|
method(name: string): MethodFn { return this.reflectionCapabilities.method(name); }
|
2015-08-19 16:56:46 -07:00
|
|
|
|
2016-05-03 17:31:40 -07:00
|
|
|
importUri(type: any): string { return this.reflectionCapabilities.importUri(type); }
|
2016-08-24 17:39:49 -07:00
|
|
|
|
2017-03-20 16:31:11 -07:00
|
|
|
resourceUri(type: any): string { return this.reflectionCapabilities.resourceUri(type); }
|
|
|
|
|
2017-05-18 13:46:51 -07:00
|
|
|
resolveIdentifier(name: string, moduleUrl: string, members: string[], runtime: any): any {
|
2017-02-14 13:33:06 -08:00
|
|
|
return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime);
|
2016-08-24 17:39:49 -07:00
|
|
|
}
|
2016-10-11 18:42:00 -07:00
|
|
|
|
2016-08-29 08:52:25 -07:00
|
|
|
resolveEnum(identifier: any, name: string): any {
|
|
|
|
return this.reflectionCapabilities.resolveEnum(identifier, name);
|
2016-08-24 17:39:49 -07:00
|
|
|
}
|
2015-04-24 13:17:36 -07:00
|
|
|
}
|