最近我听说过“POJOs”(普通旧Java对象)。我谷歌了一下,但仍然不太理解这个概念。有人能给我一个清晰的POJO描述吗?
考虑一个类"Person",包含变量"id,name,address,salary"——我如何为这种情况创建一个POJO?下面的代码是POJO吗?
public class Person {
//variables
People people = new People();
private int id;
private String name;
private String address;
private int salary;
public int getId() {
return id;
}
public String getName() {
return name;
}
public String getAddress() {
return address;
}
public int getSalary() {
return salary;
}
public void setId() {
this.id = id;
}
public void setName() {
this.name = name;
}
public void setAddress() {
this.address = address;
}
public void setSalary() {
this.salary = salary;
}
}