Page Contents

Home > @loopback/metadata > DecoratorFactory > getTargetName

DecoratorFactory.getTargetName() method

Get the qualified name of a decoration target.

Signature:

static getTargetName(target: Object, member?: string | symbol, descriptorOrIndex?: TypedPropertyDescriptor<any> | number): string;

Parameters

Parameter Type Description

target

Object

Class or prototype of a class

member

string | symbol

(Optional) Optional property/method name

descriptorOrIndex

TypedPropertyDescriptor<any> | number

(Optional) Optional method descriptor or parameter index

Returns:

string

Remarks

Example of target names:

  • 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