Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Annotations

A helper class for managing annotations

Hierarchy

  • Annotations

Index

Methods

Static applyToClass

  • applyToClass<T>(annotation: T, target: any): T

Static applyToConstructorParameter

  • applyToConstructorParameter<T>(annotation: T, target: any, index: number): T
  • Apply this annotation instance to the given constructor parameter.

    Type parameters

    Parameters

    • annotation: T
    • target: any
    • index: number

    Returns T

Static applyToMethod

  • applyToMethod<T>(annotation: T, target: any, name: string): T
  • Apply this annotation instance to the given method.

    Type parameters

    Parameters

    • annotation: T
    • target: any
    • name: string

    Returns T

Static applyToParameter

  • applyToParameter<T>(annotation: T, target: any, name: string, index: number): T
  • Apply this annotation instance to the given method parameter.

    Type parameters

    Parameters

    • annotation: T
    • target: any
    • name: string
    • index: number

    Returns T

Static applyToProperty

  • applyToProperty<T>(annotation: T, target: any, name: string): T
  • Apply this annotation instance to the given property.

    Type parameters

    Parameters

    • annotation: T
    • target: any
    • name: string

    Returns T

Static clone

  • clone<T>(annotation: T): T
  • Clone the given Annotation instance into a new instance. This is not a deep copy.

    Type parameters

    Parameters

    • annotation: T

    Returns T

Static copyClassAnnotations

  • copyClassAnnotations(from: Function, to: Function): void
  • Copy the annotations defined for one class onto another.

    Parameters

    • from: Function

      The class to copy annotations from

    • to: Function

      The class to copy annotations to

    Returns void

Static getClassAnnotations

  • Get all annotations (including from Angular and other compatible frameworks).

    Parameters

    • target: any

      The target to fetch annotations for

    Returns IAnnotation[]

Static getConstructorParameterAnnotations

  • getConstructorParameterAnnotations(type: any): IAnnotation[][]
  • Get the annotations defined on the parameters of the given method of the given class.

    Parameters

    • type: any

    Returns IAnnotation[][]

Static getMapForClassProperties

  • getMapForClassProperties(target: Object, mapToPopulate?: Record<string, IAnnotation[]>): Record<string, IAnnotation[]>
  • Gets a map of the annotations defined on all properties of the given class/function. To get the annotations of instance fields, make sure to use Class.prototype, otherwise static annotations are returned.

    Parameters

    • target: Object
    • Optional mapToPopulate: Record<string, IAnnotation[]>

    Returns Record<string, IAnnotation[]>

Static getMapForMethodParameters

  • getMapForMethodParameters(target: Object, mapToPopulate?: Record<string, IAnnotation[][]>): Record<string, IAnnotation[][]>
  • Get a map of the annotations defined on all parameters of all methods of the given class/function. To get instance methods, make sure to pass Class.prototype, otherwise the results are for static fields.

    Parameters

    • target: Object
    • Optional mapToPopulate: Record<string, IAnnotation[][]>

    Returns Record<string, IAnnotation[][]>

Static getMethodAnnotations

  • getMethodAnnotations(target: any, methodName: string, isStatic?: boolean): IAnnotation[]
  • Get all annotations (including from Angular and other compatible frameworks).

    Parameters

    • target: any

      The target to fetch annotations for

    • methodName: string
    • Default value isStatic: boolean = false

    Returns IAnnotation[]

Static getParameterAnnotations

  • getParameterAnnotations(type: any, methodName: string, isStatic?: boolean): IAnnotation[][]
  • Get the annotations defined on the parameters of the given method of the given class.

    Parameters

    • type: any
    • methodName: string
    • Default value isStatic: boolean = false

      Whether type itself (isStatic = true), or type.prototype (isStatic = false) should be the target. Note that passing true may indicate that the passed type is already the prototype of a class.

    Returns IAnnotation[][]

Static getPropertyAnnotations

  • getPropertyAnnotations(target: any, methodName: string, isStatic?: boolean): IAnnotation[]
  • Get all annotations (including from Angular and other compatible frameworks).

    Parameters

    • target: any

      The target to fetch annotations for

    • methodName: string
    • Default value isStatic: boolean = false

    Returns IAnnotation[]

Generated using TypeDoc