相关疑难解决方法(0)

POJO有什么优势?

在我的项目中,我有一个小的数据结构Key.

public class Key implements Serializable {

  private static final long serialVersionUID = 1L;

  public String db;
  public String ref;
  public Object id;

  protected Key() {
  }

  public Key(String db, String ref, Object id) {
    this.db = db;
    this.ref = ref;
    this.id = id;
  }
}
Run Code Online (Sandbox Code Playgroud)

是的,这个课程很简单,每个领域都可公开访问.

但有人建议我使用POJO风格的课程,但当我问他们为什么无法告诉我.

在我看来,调用gettersetter比直接访问字段要慢.

那么为什么我必须使用POJO编程风格呢?

java pojo

10
推荐指数
2
解决办法
2万
查看次数

标签 统计

java ×1

pojo ×1