在java中,我有一个这样的类:
public class MyClass extends Properties {
public StringProperty prop1 = new StringProperty(this, "default value for prop1");
public StringProperty prop2 = new StringProperty(this, "prop2 default val");
}//MyClass
父类“Properties”使用反射来查找本身的所有公共字段,并根据需要用值填充变量。
我将如何在 scala 中扩展属性?使用var prop1:StringProperty ...
不起作用,我假设由于 scala 如何将私有字段转换为获取...设置...类型方法。