It has fields corresponding to the database columns and the usual accessors (getters and setters) for each field.
它有与数据库列对应的字段及用于每个字段的常用存取器(getter和setter)。
The Groovy version is much, much smaller because Groovy's default property semantics automatically define a private field with public accessors and mutators.
Groovy 版的代码要少很多很多,这是因为 Groovy 的默认属性语义用 public 访问器和存取器自动定义了 private 域。
Earlier we talked about how accessors are slower than direct field accesses, so this is an example of a certain language idiom resulting in an "invisible" performance hit.
之前提到过存取器访问如何比直接访问慢,这例子说明,某些语言约会定导致不可见的性能问题。
应用推荐