Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Reflector

Helper class providing Nest reflection capabilities.

see

Reflection

publicapi

Hierarchy

  • Reflector

Index

Methods

get

  • get<TResult, TKey>(metadataKey: TKey, target: Type<any> | Function): TResult
  • Retrieve metadata for a specified key for a specified target.

    example

    const roles = this.reflector.get<string[]>('roles', context.getHandler());

    Type parameters

    • TResult = any

    • TKey = any

    Parameters

    • metadataKey: TKey

      lookup key for metadata to retrieve

    • target: Type<any> | Function

      context (decorated object) to retrieve metadata from

    Returns TResult

getAll

  • getAll<TResult, TKey>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult
  • Retrieve metadata for a specified key for a specified set of targets.

    Type parameters

    • TResult: any[] = any[]

    • TKey = any

    Parameters

    • metadataKey: TKey

      lookup key for metadata to retrieve

    • targets: (Type<any> | Function)[]

      context (decorated objects) to retrieve metadata from

    Returns TResult

getAllAndMerge

  • getAllAndMerge<TResult, TKey>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult
  • Retrieve metadata for a specified key for a specified set of targets and merge results.

    Type parameters

    • TResult: any[] = any[]

    • TKey = any

    Parameters

    • metadataKey: TKey

      lookup key for metadata to retrieve

    • targets: (Type<any> | Function)[]

      context (decorated objects) to retrieve metadata from

    Returns TResult

getAllAndOverride

  • getAllAndOverride<TResult, TKey>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult
  • Retrieve metadata for a specified key for a specified set of targets and return a first not undefined value.

    Type parameters

    • TResult = any

    • TKey = any

    Parameters

    • metadataKey: TKey

      lookup key for metadata to retrieve

    • targets: (Type<any> | Function)[]

      context (decorated objects) to retrieve metadata from

    Returns TResult

Generated using TypeDoc