From b8c4d3e7fbb563fe3ff8bd4f47cba4c7c589033c Mon Sep 17 00:00:00 2001 From: vsavkin Date: Mon, 21 Sep 2015 13:41:52 -0700 Subject: [PATCH] docs(di): add docs to Key --- modules/angular2/src/core/di/key.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/angular2/src/core/di/key.ts b/modules/angular2/src/core/di/key.ts index 5148d94936..7b10b0538e 100644 --- a/modules/angular2/src/core/di/key.ts +++ b/modules/angular2/src/core/di/key.ts @@ -11,18 +11,27 @@ export {TypeLiteral} from './type_literal'; * * Keys have: * - a system-wide unique `id`. - * - a `token`, usually the `Type` of the instance. + * - a `token`. * - * Keys are used internally by the {@link Injector} because their system-wide unique `id`s allow the - * injector to index in arrays rather than looking up items in maps. + * `Key` is used internally by {@link Injector} because its system-wide unique `id` allows the + * injector to store created objects in a more efficient way. + * + * `Key` should not be created directly. {@link Injector} creates keys automatically when resolving + * bindings. */ export class Key { + /** + * Private + */ constructor(public token: Object, public id: number) { if (isBlank(token)) { throw new BaseException('Token must be defined!'); } } + /** + * Returns a stringified token. + */ get displayName(): string { return stringify(this.token); } /**