我在这个问题上花了很多时间,但无济于事。理想情况下,我想将参数传递给动态生成的类的构造函数。问题是我不知道如何使用参数化构造函数进行实例化。
到目前为止,我的实例化方法是......
CtClass myClass . . .
myClass.addInterfaces(.... //assume I have an interface that is nondynamic
InterfaceName interfaceinstance = (InterfaceName) (myClass.toClass().newInstance());
有没有更好的方法可以提供更大的灵活性?
非常感谢!
RB