Class: classdecoratorfactory = new ClassDecoratorFactory()

Factory for class decorators

create() : ClassDecorator

createDecorator(key: string, spec: T, options: DecoratorOptions) :

Create a class decorator function

Arguments
Name Type Description
key string

Metadata key

spec T

Metadata object from the decorator function

options DecoratorOptions

Options for the decorator

Class: decoratorfactory = new DecoratorFactory()

Base factory class for decorator functions

Properties
Name Type Description
TARGET string

A constant to reference the target of a decoration

constructor(key: string, spec: T, options: DecoratorOptions) : DecoratorFactory

Construct a new class decorator factory

Arguments
Name Type Description
key string

Metadata key

spec T

Metadata object from the decorator function

options DecoratorOptions

Options for the decorator. Default to
{allowInheritance: true} if not provided

create() : D

Create a decorator function of the given type. Each sub class MUST
implement this method.

getNumberOfParameters(target: Object, member: undefined) : number

Get the number of parameters for a given constructor or method

Arguments
Name Type Description
target Object

Class or the prototype

member

Method name

getTarget(spec: T) : any

Get the optional decoration target of a given spec

Arguments
Name Type Description
spec T

Metadata spec

getTargetName(target: Object, member: undefined, descriptorOrIndex: undefined) : string

Get name of a decoration target

Arguments
Name Type Description
target Object

Class or prototype of a class

member

Optional property/method name

descriptorOrIndex

Optional method descriptor or parameter index

withTarget(spec: T, target: Object) : T

Set a reference to the target class or prototype for a given spec if
it's an object

Arguments
Name Type Description
spec T

Metadata spec

target Object

Target of the decoration. It is a class or the prototype of
a class.

cloneDeep(val: T) : T

Arguments
Name Type Description
val T

Base factory class for decorator functions

Class: methoddecoratorfactory = new MethodDecoratorFactory()

Factory for method decorators

create() : MethodDecorator

createDecorator(key: string, spec: T, options: DecoratorOptions) :

Create a method decorator function

Arguments
Name Type Description
key string

Metadata key

spec T

Metadata object from the decorator function

options DecoratorOptions

Options for the decorator

Class: methodparameterdecoratorfactory = new MethodParameterDecoratorFactory()

Factory for method level parameter decorator. For example, the following
code uses @param to declare two parameters for greet().

class MyController {
  @param('name') // Parameter 0
  @param('msg')  // Parameter 1
  greet() {}
}

create() : MethodDecorator

createDecorator(key: string, spec: T, options: DecoratorOptions) :

Create a method decorator function

Arguments
Name Type Description
key string

Metadata key

spec T

Metadata object from the decorator function

options DecoratorOptions

Options for the decorator

Class: parameterdecoratorfactory = new ParameterDecoratorFactory()

Factory for parameter decorators

create() : ParameterDecorator

createDecorator(key: string, spec: T, options: DecoratorOptions) :

Create a parameter decorator function

Arguments
Name Type Description
key string

Metadata key

spec T

Metadata object from the decorator function

options DecoratorOptions

Options for the decorator

Class: propertydecoratorfactory = new PropertyDecoratorFactory()

Factory for property decorators

create() : PropertyDecorator

createDecorator(key: string, spec: T, options: DecoratorOptions) :

Create a property decorator function

Arguments
Name Type Description
key string

Metadata key

spec T

Metadata object from the decorator function

options DecoratorOptions

Options for the decorator

Interface: DecoratorOptions

Options for a decorator

Properties
Name Type Description
allowInheritance boolean

Controls if inherited metadata will be honored. Default to true.

cloneInputSpec boolean

Controls if the value of spec argument will be cloned. Sometimes we
use shared spec for the decoration, but the decorator function might need
to mutate the object. Cloning the input spec makes it safe to use the same
spec (template) to decorate different members.

Default to true.

Interface: MetadataMap

An object mapping keys to corresponding metadata

Class: namespacedreflect = new NamespacedReflect()

constructor(namespace: string) : NamespacedReflect

Arguments
Name Type Description
namespace string

: namespace to bind this reflect context

decorate(decorators: undefined, target: Object, targetKey: undefined, descriptor: PropertyDescriptor) : PropertyDescriptor | Function

Arguments
Name Type Description
decorators
target Object
targetKey
descriptor PropertyDescriptor

defineMetadata(metadataKey: string, metadataValue: any, target: Object, propertyKey: undefined) : void

define metadata for a target class or it's property/method

Arguments
Name Type Description
metadataKey string
metadataValue any
target Object
propertyKey

deleteMetadata(metadataKey: string, target: Object, propertyKey: undefined) : boolean

Arguments
Name Type Description
metadataKey string
target Object
propertyKey

getMetadata(metadataKey: string, target: Object, propertyKey: undefined) : any

lookup metadata from a target object and its prototype chain

Arguments
Name Type Description
metadataKey string
target Object
propertyKey

getMetadataKeys(target: Object, propertyKey: undefined) :

Arguments
Name Type Description
target Object
propertyKey

getOwnMetadata(metadataKey: string, target: Object, propertyKey: undefined) : any

get own metadata for a target object or it's property/method

Arguments
Name Type Description
metadataKey string
target Object
propertyKey

getOwnMetadataKeys(target: Object, propertyKey: undefined) :

Arguments
Name Type Description
target Object
propertyKey

hasMetadata(metadataKey: string, target: Object, propertyKey: undefined) : boolean

Check if the target has corresponding metadata

Arguments
Name Type Description
metadataKey string

Key

target Object

Target

propertyKey

Optional property key

hasOwnMetadata(metadataKey: string, target: Object, propertyKey: undefined) : boolean

Arguments
Name Type Description
metadataKey string
target Object
propertyKey

metadata(metadataKey: string, metadataValue: any) :

Arguments
Name Type Description
metadataKey string
metadataValue any