refactor(core): remove …Metadata for all decorators and use the decorator directly.

BREAKING CHANGE:
- all `…Metadata` classes have been removed. Use the corresponding decorator
  as constructor or for `instanceof` checks instead.
- Example:
  * Before: `new ComponentMetadata(…)`
  * After: `new Component(…)`
- Note: `new Component(…)` worked before as well.
This commit is contained in:
Tobias Bosch
2016-09-12 19:14:17 -07:00
committed by Igor Minar
parent 1b15170c89
commit 63e15ffaec
40 changed files with 229 additions and 279 deletions

View File

@ -6,17 +6,17 @@
* found in the LICENSE file at https://angular.io/license
*/
import {Injectable, PipeMetadata, Type, resolveForwardRef} from '@angular/core';
import {Injectable, Pipe, Type, resolveForwardRef} from '@angular/core';
import {isPresent, stringify} from './facade/lang';
import {ReflectorReader, reflector} from './private_import_core';
function _isPipeMetadata(type: any): boolean {
return type instanceof PipeMetadata;
return type instanceof Pipe;
}
/**
* Resolve a `Type` for {@link PipeMetadata}.
* Resolve a `Type` for {@link Pipe}.
*
* This interface can be overridden by the application developer to create custom behavior.
*
@ -27,9 +27,9 @@ export class PipeResolver {
constructor(private _reflector: ReflectorReader = reflector) {}
/**
* Return {@link PipeMetadata} for a given `Type`.
* Return {@link Pipe} for a given `Type`.
*/
resolve(type: Type<any>, throwIfNotFound = true): PipeMetadata {
resolve(type: Type<any>, throwIfNotFound = true): Pipe {
var metas = this._reflector.annotations(resolveForwardRef(type));
if (isPresent(metas)) {
var annotation = metas.find(_isPipeMetadata);