JavaSE实体类
1.写表中的变量
public class Book {
public int id;
public String bookname;
public String bookauthor;
public String bookuser;
public String booktext;
public int booklevel;
public int booktype;
public int bookprice;
public int bookflag;
public int flagdeteled;
public String bookaddress;
public String bookpublic;
public String bookmobile;
}
2.shift+alt+s
①Generate Getters and Setters...
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getBookname() {
return bookname;
}
public void setBookname(String bookname) {
this.bookname = bookname;
}
public String getBookauthor() {
return bookauthor;
}
public void setBookauthor(String bookauthor) {
this.bookauthor = bookauthor;
}
public String getBookuser() {
return bookuser;
}
public void setBookuser(String bookuser) {
this.bookuser = bookuser;
}
public String getBooktext() {
return booktext;
}
public void setBooktext(String booktext) {
this.booktext = booktext;
}
public int getBooklevel() {
return booklevel;
}
public void setBooklevel(int booklevel) {
this.booklevel = booklevel;
}
public int getBooktype() {
return booktype;
}
public void setBooktype(int booktype) {
this.booktype = booktype;
}
public int getBookprice() {
return bookprice;
}
public void setBookprice(int bookprice) {
this.bookprice = bookprice;
}
public int getBookflag() {
return bookflag;
}
public void setBookflag(int bookflag) {
this.bookflag = bookflag;
}
public int getFlagdeteled() {
return flagdeteled;
}
public void setFlagdeteled(int flagdeteled) {
this.flagdeteled = flagdeteled;
}
public String getBookaddress() {
return bookaddress;
}
public void setBookaddress(String bookaddress) {
this.bookaddress = bookaddress;
}
public String getBookpublic() {
return bookpublic;
}
public void setBookpublic(String bookpublic) {
this.bookpublic = bookpublic;
}
public String getBookmobile() {
return bookmobile;
}
public void setBookmobile(String bookmobile) {
this.bookmobile = bookmobile;
}
②Generate toString()...
@Override
public String toString() {
return "Book [id=" + id + ", bookname=" + bookname + ", bookauthor=" + bookauthor + ", bookuser=" + bookuser+ ", booktext=" + booktext + ", booklevel=" + booklevel + ",booktype=" + booktype + ", bookprice="+ bookprice + ", bookflag=" + bookflag + ", flagdeteled=" + flagdeteled + ", bookaddress=" + bookaddress+ ", bookpublic=" + bookpublic + ",bookmobile=" + bookmobile + "]";
}
③Generate Constructor using Fields...
public Book(int id, String bookname, String bookauthor, String bookuser, String booktext, int booklevel,
int booktype, int bookprice, int bookflag, int flagdeteled, String bookaddress, String bookpublic,
String bookmobile) {
super();
this.id = id;
this.bookname = bookname;
this.bookauthor = bookauthor;
this.bookuser = bookuser;
this.booktext = booktext;
this.booklevel = booklevel;
this.booktype = booktype;
this.bookprice = bookprice;
this.bookflag = bookflag;
this.flagdeteled = flagdeteled;
this.bookaddress = bookaddress;
this.bookpublic = bookpublic;
this.bookmobile = bookmobile;
}
④Generate Constructors from Superclass...
public Book() {
}