我将自己的getter和setter添加到变量中:
class Person{
private var age = 0
def currentAge = age
def currentAge_=(age: Int) = this.age = age
}
Run Code Online (Sandbox Code Playgroud)
看编译版本给出:
public class Person implements scala.ScalaObject {
private int age;
private int age();
private void age_$eq(int);
public int currentAge();
public void currentAge_$eq(int);
public Person();
}
Run Code Online (Sandbox Code Playgroud)
我想避免自动生成默认的getter和setter.可能吗?
| 归档时间: |
|
| 查看次数: |
403 次 |
| 最近记录: |