Factory for class decorators
Create a class decorator function
| Name | Type | Description |
|---|---|---|
| key |
string
|
Metadata key |
| spec |
T
|
Metadata object from the decorator function |
| options |
DecoratorOptions
|
Options for the decorator |
Base factory class for decorator functions
| Name | Type | Description |
|---|---|---|
| TARGET |
string
|
A constant to reference the target of a decoration |
Construct a new class decorator factory
| Name | Type | Description |
|---|---|---|
| key |
string
|
Metadata key |
| spec |
T
|
Metadata object from the decorator function |
| options |
DecoratorOptions
|
Options for the decorator. Default to
|
Create a decorator function of the given type. Each sub class MUST implement this method.
Get the optional decoration target of a given spec
| Name | Type | Description |
|---|---|---|
| spec |
T
|
Metadata spec |
Set a reference to the target class or prototype for a given spec if it's an object
| Name | Type | Description |
|---|---|---|
| spec |
T
|
Metadata spec |
| target |
Object
|
Target of the decoration. It is a class or the prototype of a class. |
| Name | Type | Description |
|---|---|---|
| val |
Readonly
|
Base factory class for decorator functions |
Get the number of parameters for a given constructor or method
| Name | Type | Description |
|---|---|---|
| target |
Object
|
Class or the prototype |
| member |
|
Method name |
Get the qualified name of a decoration target. For example:
class MyClass
MyClass.constructor[0] // First parameter of the constructor
MyClass.myStaticProperty
MyClass.myStaticMethod()
MyClass.myStaticMethod[0] // First parameter of the myStaticMethod
MyClass.prototype.myProperty
MyClass.prototype.myMethod()
MyClass.prototype.myMethod[1] // Second parameter of myMethod
| Name | Type | Description |
|---|---|---|
| target |
Object
|
Class or prototype of a class |
| member |
|
Optional property/method name |
| descriptorOrIndex |
|
Optional method descriptor or parameter index |
Factory for method decorators
Create a method decorator function
| Name | Type | Description |
|---|---|---|
| key |
string
|
Metadata key |
| spec |
T
|
Metadata object from the decorator function |
| options |
DecoratorOptions
|
Options for the decorator |
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 a method decorator function
| Name | Type | Description |
|---|---|---|
| key |
string
|
Metadata key |
| spec |
T
|
Metadata object from the decorator function |
| options |
DecoratorOptions
|
Options for the decorator |
Factory for parameter decorators
Create a parameter decorator function
| Name | Type | Description |
|---|---|---|
| key |
string
|
Metadata key |
| spec |
T
|
Metadata object from the decorator function |
| options |
DecoratorOptions
|
Options for the decorator |
Factory for property decorators
Create a property decorator function
| Name | Type | Description |
|---|---|---|
| key |
string
|
Metadata key |
| spec |
T
|
Metadata object from the decorator function |
| options |
DecoratorOptions
|
Options for the decorator |
Options for a decorator
An object mapping keys to corresponding metadata
Inspector for metadata applied by decorators
| Name | Type | Description |
|---|---|---|
| DesignTimeReflector |
NamespacedReflect
|
Expose the reflector for TypeScript design-time metadata |
| Reflector |
NamespacedReflect
|
Expose Reflector, which is a wrapper of |
Define metadata for the given target
| Name | Type | Description |
|---|---|---|
| key |
string
|
Metadata key |
| value |
T
|
Metadata value |
| target |
Object
|
Target for the metadata |
| member |
|
Optional property or method name |
Get the metadata associated with the given key for all methods of the target class or prototype
| Name | Type | Description |
|---|---|---|
| key |
string
|
Metadata key |
| target |
Object
|
Class for static methods or prototype for instance methods |
| options |
InspectionOptions
|
Options for inspection |
Get the metadata associated with the given key for all parameters of a given method
| Name | Type | Description |
|---|---|---|
| key |
string
|
Metadata key |
| target |
Object
|
Class for static methods or prototype for instance methods |
| methodName |
|
Method name. If not present, default to '' to use the constructor |
| options |
InspectionOptions
|
Options for inspection |
Get the metadata associated with the given key for all properties of the target class or prototype
| Name | Type | Description |
|---|---|---|
| key |
string
|
Metadata key |
| target |
Object
|
Class for static methods or prototype for instance methods |
| options |
InspectionOptions
|
Options for inspection |
Get the metadata associated with the given key for a given class
| Name | Type | Description |
|---|---|---|
| key |
string
|
Metadata key |
| target |
Function
|
Class that contains the metadata |
| options |
InspectionOptions
|
Options for inspection |
Get TypeScript design time type for a method
| Name | Type | Description |
|---|---|---|
| target |
Object
|
Class or prototype |
| methodName |
|
Method name |
Get TypeScript design time type for a property
| Name | Type | Description |
|---|---|---|
| target |
Object
|
Class or prototype |
| propertyName |
|
Property name |
Get the metadata associated with the given key for a given method of the target class or prototype
| Name | Type | Description |
|---|---|---|
| key |
string
|
Metadata key |
| target |
Object
|
Class for static methods or prototype for instance methods |
| methodName |
|
Method name. If not present, default to '' to use the constructor |
| options |
InspectionOptions
|
Options for inspection |
Get the metadata associated with the given key for a parameter of a given method by index
| Name | Type | Description |
|---|---|---|
| key |
string
|
Metadata key |
| target |
Object
|
Class for static methods or prototype for instance methods |
| methodName |
|
Method name. If not present, default to '' to use the constructor |
| index |
number
|
Index of the parameter, starting with 0 |
| options |
InspectionOptions
|
Options for inspection |
Get the metadata associated with the given key for a given property of the target class or prototype
| Name | Type | Description |
|---|---|---|
| key |
string
|
Metadata key |
| target |
Object
|
Class for static properties or prototype for instance properties |
| propertyName |
|
Property name |
| options |
InspectionOptions
|
Options for inspection |
Design time metadata for a method.
| Name | Type | Description |
|---|---|---|
| parameterTypes |
|
An array of parameter types |
| returnType |
Function
|
Return type |
| type |
Function
|
Type of the method itself. It is |
Options for inspection
| Name | Type | Description |
|---|---|---|
| namespace |
|
: namespace to bind this reflect context |
| Name | Type | Description |
|---|---|---|
| decorators |
|
|
| target |
Object
|
|
| targetKey |
|
|
| descriptor |
PropertyDescriptor
|
define metadata for a target class or it's property/method
| Name | Type | Description |
|---|---|---|
| metadataKey |
string
|
|
| metadataValue |
any
|
|
| target |
Object
|
|
| propertyKey |
|
| Name | Type | Description |
|---|---|---|
| metadataKey |
string
|
|
| target |
Object
|
|
| propertyKey |
|
lookup metadata from a target object and its prototype chain
| Name | Type | Description |
|---|---|---|
| metadataKey |
string
|
|
| target |
Object
|
|
| propertyKey |
|
| Name | Type | Description |
|---|---|---|
| target |
Object
|
|
| propertyKey |
|
get own metadata for a target object or it's property/method
| Name | Type | Description |
|---|---|---|
| metadataKey |
string
|
|
| target |
Object
|
|
| propertyKey |
|
| Name | Type | Description |
|---|---|---|
| target |
Object
|
|
| propertyKey |
|
Check if the target has corresponding metadata
| Name | Type | Description |
|---|---|---|
| metadataKey |
string
|
Key |
| target |
Object
|
Target |
| propertyKey |
|
Optional property key |
| Name | Type | Description |
|---|---|---|
| metadataKey |
string
|
|
| target |
Object
|
|
| propertyKey |
|
| Name | Type | Description |
|---|---|---|
| metadataKey |
string
|
|
| metadataValue |
any
|