Commodity entity class design
Examples of commodities here are books. We will build it as a JavaBean class to improve the reuse of code and the maintainability of the program. Here's a little trick to quickly add a lot of setters and getter: Right-click your class name and choose from the pop-up menu: "Source"-> "Generate getters and Setters"-> "Select All"-> " OK ".
Package entity;
Import Java.util.Date;
public class Book {//books related attributes, which need to be set to private permissions, and the Privacy String ISBN;
private String name;
Private String author; Private String intro;
Book Introduction private float Price_original;
private float price;
Private String Publish_comany;
Private Date Publish_time;
Private String Img_path;
There are all the getter and setter public String GETISBN () {return ISBN for all properties of the parameterless constructor public book () {}//;
public void Setisbn (String ISBN) {this.isbn = ISBN;
Public String GetName () {return name;
public void SetName (String name) {this.name = name;
Public String Getauthor () {return author;
} public void Setauthor (String author) {this.author = author;
Public String Getintro () {return intro;
} public void Setintro (String intro) {This.intro = intro; public float getprice_original () {return price_original;
public void setprice_original (float price_original) {this.price_original = price_original;
public float GetPrice () {return price;
public void Setprice (float price) {this.price = Price;
Public String Getpublish_comany () {return publish_comany;
} public void Setpublish_comany (String publish_comany) {this.publish_comany = Publish_comany;
Public Date Getpublish_time () {return publish_time;
The public void Setpublish_time (Date publish_time) {this.publish_time = Publish_time;
Public String Getimg_path () {return img_path;
} public void Setimg_path (String img_path) {this.img_path = Img_path; }
}
You can click here to see more about JavaBean.