构造方法直接赋值之后,set方法还需要定义吗,是为了方便继续使用还是有其必要性
package cn.campsg.gm.entity;
public class User {
private String id = null;
private String name = null;
private String password = null;
private Byte sex = null;
private String city = null;
private ShoppingCart cart = null;
public User() {
cart = new ShoppingCart();
}
public User(String id, String name, String password, Byte sex,
String city) {
this();
this.id = id;
this.name = name;
this.password = password;
this.sex = sex;
this.city = city;
}
public ShoppingCart getCart() {
return cart;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Byte getSex() {
return sex;
}
public void setSex(Byte sex) {
this.sex = sex;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
}