ArkTS是否支持反射调用类的静态成员函数和实例成员函数
============================

ArkTS 可以通过动态 import 实现反射功能，支持根据类名和方法名调用类中的静态成员函数和实例成员函数。示例如下：

在harlibrary中定义类及其成员函数和全局函数，并进行导出。

_// harlibrary's src/main/ets/utils/Calc.ets_
export class Calc {
  public static staticAdd(a:number, b:number):number {
    let c = a + b;
    console.log('DynamicImport I am harlibrary in staticAdd, %d + %d = %d', a, b, c);
    return c;
  }
  public instanceAdd(a:number, b:number):number {
    let c = a + b;
    console.log('DynamicImport I am harlibrary in instanceAdd, %d + %d = %d', a, b, c);
    return c;
  }
}
export function addHarlibrary(a:number, b:number):number {
  let c = a + b;
  console.log('DynamicImport I am harlibrary in addHarlibrary, %d + %d = %d', a, b, c);
  return c;
}

_// harlibrary's Index.ets_
export { Calc, addHarlibrary } from './src/main/ets/utils/Calc'

在HAP中添加对HARLibrary模块的依赖，动态导入HARLibrary模块，并调用其静态成员函数staticAdd()、实例成员函数instanceAdd()以及全局方法addHarlibrary()。

_// HAP's oh-package.json5_
"dependencies": {
  "harlibrary": "file:../harlibrary"
},

_// HAP's Index.ets_
import('harlibrary').then((ns:ESObject) => {
  ns.Calc.staticAdd(8, 9); _ // Call static member functions staticAdd()_
  let calc:ESObject = new ns.Calc();  _// Instantiate class Calc_
  calc.instanceAdd(10, 11);  _// Call member functions instanceAdd()_
  ns.addHarlibrary(6, 7); _ // Call global methods addHarlibrary()_

 _ // Use string names of classes, member functions, and methods for reflection calls_
  let className = 'Calc';
  let methodName = 'instanceAdd';
  let staticMethod = 'staticAdd';
  let functionName = 'addHarlibrary';
  ns\[className\]\[staticMethod\](12, 13);  _// Call static member functions staticAdd()_
  let calc1:ESObject = new ns\[className\](); _ // Instantiate class Calc_
  calc1\[methodName\](14, 15); _ // Call member functions instanceAdd()_
  ns\[functionName\](16, 17); _ // Call global methods addHarlibrary()_
});

具体可以参考：[业务扩展场景介绍](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-dynamic-import#业务扩展场景介绍)。