Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Class<T>

The reflected class for a class.

final

Type parameters

  • T

Hierarchy

  • Class

Index

Constructors

constructor

  • new Class(name: string, klass: T): Class
  • Parameters

    • name: string

      full name

    • klass: T

      class constructor

    Returns Class

Properties

Readonly name

name: string

Full name

Readonly shortName

shortName: string

Methods

aop

  • aop<T>(method: string, advisor: AopAdvisor<T>): void
  • Aspect a method of this class.

    Type parameters

    • T

    Parameters

    • method: string

      method name

    • advisor: AopAdvisor<T>

    Returns void

cancelAop

  • cancelAop(method?: string): void
  • Cancel all advisors of this class method.

    Parameters

    • Optional method: string

      method name

    Returns void

equals

  • Equals a reflected Class.

    Parameters

    Returns boolean

field

  • field(name: string, instance?: object): Field
  • Returns a reflected Field.

    Parameters

    • name: string

      field name

    • Optional instance: object

      Need a class instance when the field is an instance-field

    Returns Field

fields

  • Returns an array of all static-fields and instance-fields.

    Parameters

    • Optional instance: object

      Need a class instance when the field is an instance-field

    • Optional anno: Annotation

      An annotation on the instance field

    Returns Field[]

fieldsMap

  • Returns a json-map of all static-fields and instance-fields.

    Parameters

    • Optional instance: object

      Need a class instance when the field is an instance-field

    • Optional anno: Annotation

      An annotation on the instance field

    Returns JsonObject<Field>

getKlass

  • getKlass<T>(): Klass<T>
  • Returns the constructor of this class.

    Type parameters

    • T

    Returns Klass<T>

getSuperclass

  • getSuperclass(): Class<T>
  • Returns the super class.

    Returns Class<T>

method

  • method(name: string): Method
  • Returns a reflected Method.

    Parameters

    • name: string

    Returns Method

methods

  • Returns an array of all reflected Methods.

    Returns Method[]

methodsMap

newInstance

  • newInstance<T>(...args: any[]): T
  • Returns a new instance of this class.

    Type parameters

    • T

    Parameters

    • Rest ...args: any[]

    Returns T

subclassOf

  • subclassOf(cls: Class<any> | Klass<any>): boolean
  • Is subclass of a class.

    Parameters

    Returns boolean

Static aliasInstance

  • aliasInstance<T>(alias: string | Klass<T>, ...args: any[]): T
  • Returns a new instance of a class constructor or its alias.

    Type parameters

    • T

    Parameters

    • alias: string | Klass<T>
    • Rest ...args: any[]

    Returns T

Static all

  • Returns all reflected Classes by full class-name.

    Returns JsonObject<Class<any>>

Static aop

  • Aspect a method of a class.

    Type parameters

    • T

    Parameters

    • klass: Klass<any>

      class constructor

    • method: string

      method name

    • advisor: AopAdvisor<T>

    Returns void

Static byName

  • byName(name: string): Klass<any>
  • Converts class full name to class constructor

    Parameters

    • name: string

    Returns Klass<any>

Static cancelAop

  • cancelAop(klass: Klass<any>, method: string): void
  • Cancel all advisors of a class method.

    Parameters

    • klass: Klass<any>

      class constructor

    • method: string

      method name

    Returns void

Static classesOf

  • classesOf(ns: string): Class<any>[]
  • Find all classes of a namespace string.

    Parameters

    • ns: string

    Returns Class<any>[]

Static forName

  • forName<T>(name: string | Klass<T>, isAlias?: boolean): Class<T>
  • Returns a reflect Class for name.

    Type parameters

    • T

    Parameters

    • name: string | Klass<T>

      full name or alias name

    • Optional isAlias: boolean

    Returns Class<T>

Static getSuperklass

Static newInstance

  • newInstance<T>(ctor: string | Klass<T>, ...args: any[]): T
  • Returns a new instance of a class constructor or its fullname.

    Type parameters

    • T

    Parameters

    • ctor: string | Klass<T>
    • Rest ...args: any[]

    Returns T

Static reflect

  • reflect<T>(klass: Klass<T>, className?: string, alias?: string): void
  • Registers a class will be reflectable.

    Type parameters

    • T

    Parameters

    • klass: Klass<T>

      class constructor

    • Optional className: string

      class full name

    • Optional alias: string

      class alias

    Returns void