1.定义类
1 package com.realhope.rmeal.bean; 2 3 /** 4 * 5 * @author Wucy 6 * 菜谱类 7 */ 8 public class Menu{ 9 private Integer _id; 10 private Integer typeID; // 菜单类型 11 private String name; // 名称 12 private String description; // 菜谱介绍 13 private Integer price; // 价格 14 private String unit; // 单位 15 private String pic; // 图片路径 16 private String remark; // 备注 17 18 19 public Menu() { 20 super(); 21 } 22 23 24 25 public Menu(Integer _id, Integer typeID, String name, String description, 26 Integer price, String unit, String pic, String remark) { 27 super(); 28 this._id = _id; 29 this.typeID = typeID; 30 this.name = name; 31 this.description = description; 32 this.price = price; 33 this.unit = unit; 34 this.pic = pic; 35 this.remark = remark; 36 } 37 38 public String getUnit() { 39 return unit; 40 } 41 42 public void setUnit(String unit) { 43 this.unit = unit; 44 } 45 46 public Integer get_id() { 47 return _id; 48 } 49 public void set_id(Integer _id) { 50 this._id = _id; 51 } 52 public Integer getTypeID() { 53 return typeID; 54 } 55 public void setTypeID(Integer typeID) { 56 this.typeID = typeID; 57 } 58 public String getName() { 59 return name; 60 } 61 public void setName(String name) { 62 this.name = name; 63 } 64 public String getDescription() { 65 return description; 66 } 67 public void setDescription(String description) { 68 this.description = description; 69 } 70 public Integer getPrice() { 71 return price; 72 } 73 public void setPrice(Integer price) { 74 this.price = price; 75 } 76 public String getPic() { 77 return pic; 78 } 79 public void setPic(String pic) { 80 this.pic = pic; 81 } 82 public String getRemark() { 83 return remark; 84 } 85 public void setRemark(String remark) { 86 this.remark = remark; 87 } 88 89 }
2.引入包
import java.util.ArrayList;
3.定义数组
private List<Menu> lstDate = new ArrayList<Menu>();
4.使用实例:
1 lstDate.clear();//清空数组 2 lstDate = new MenuManager(this).queryMenus(type_id);//实例 3 PageCount = (int) Math.ceil(lstDate.size() / PAGE_SIZE);// 数组大小