Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Annotations

Annotation helper 注解工具类

Hierarchy

  • Annotations

Index

Methods

Static define

  • Define a annotation 定义注解标记

    Parameters

    Returns Function | PropertyDescriptor

Static getAnnotations

  • getAnnotations(obj: object | Klass<any>): string[]
  • Returns all annotations of a class or its instance. 返回类或实例的所有注解名

    Parameters

    • obj: object | Klass<any>

    Returns string[]

Static getPropertyType

  • getPropertyType(obj: object, propertyKey: string): any
  • Returns the type of an object property. 返回实例的字段的类型

    Parameters

    • obj: object
    • propertyKey: string

    Returns any

Static getValue

  • Returns the value of an annotation on a class. 返回类的注解的值

    Parameters

    Returns any

  • Gets the value of an annotation on a class's property. 返回实例属性的注解的值

    Parameters

    • anno: Annotation
    • obj: object
    • propertyKey: string

    Returns any

Static hasAnnotation

  • hasAnnotation(anno: Annotation, obj: object | Klass<any>, propertyKey?: string): boolean
  • True when the class or its property has the annotation. 某个类或实例是否有指定的注解

    Parameters

    • anno: Annotation
    • obj: object | Klass<any>

      a class instance

    • Optional propertyKey: string

    Returns boolean

Static setValue

  • setValue(annoName: string | Annotation, metaValue: any, obj: Klass<any>): void
  • setValue(annoName: string | Annotation, metaValue: any, obj: object, propertyKey: string): void
  • Sets the value of an annotation on a class. 给类的注解赋值

    Parameters

    Returns void

  • Sets the value of an annotation on a class's property. 给实例的属性注解赋值

    Parameters

    • annoName: string | Annotation
    • metaValue: any
    • obj: object
    • propertyKey: string

    Returns void