当将scala字段标准为@BeanProperty时,会自动生成get/set方法。
例如代码如下:
import scala.reflect.BeanProperty class Counter_3 { @BeanProperty var name: String = "hello" } object Counter_3 { def main(args: Array[String]) { var counter_3 = new Counter_3 counter_3.setName("chen") print(counter_3.getName) counter_3.name println() counter_3.name = "skdkd" counter_3.name_= ("sdsd") println(counter_3.name) } }