API
@agape/metadata

Name Decorator

Specifies a name for the decorated class, property, method, or parameter.

API

@Name(  name: string)

Name

Specifies a name for the decorated class, property, method, or parameter.

@paramname:  string

Description

Specifies a name for the decorated class, property, method, or parameter.

Names are used to identify the decorated element and can be used for serialization, validation, and other metadata-driven operations.

This decorator sets the name property on the associated MetadataDescriptor.

Usage

Class

@Name('Product')
class Product {
  name: string;
  price: number;
}

Property

class Product {
  @Name('skuCode')
  sku: string;
}

Method

class ProductService {
  @Name('createProduct')
  create(): void {
    // ...
  }
}

Parameter

class ProductService {
  create(@Name('product') product: Product): void {
    // ...
  }
}