?? usermodel.java
字號:
package cn.javass.bookmgr.user.valueobject;/** * 用戶實體的值對象 * * <p>Title: Java私塾第一個Java項目——圖書進銷存系統(單機版)</p> * <p>Description: 網址:<a href="http://www.javass.cn">http://www.javass.cn</a> * 新電話:010-86835215 新地址:北京市海淀區廠洼路5號院深博達商務樓5層</p> * <p>Copyright: Copyright (c) 2008</p> * <p>Company: Java私塾</p> * @author Java私塾 * @version 1.0 */public class UserModel implements java.io.Serializable{ private String id,name,pwd; private int type; public final static String TYPE_1 = "admin"; public final static String TYPE_2 = "可操作用戶模塊"; public final static String TYPE_3 = "可操作圖書模塊"; public final static String TYPE_4 = "可操作進貨模塊"; public final static String TYPE_5 = "可操作銷售模塊"; public final static String TYPE_6 = "可操作庫存模塊"; public final static int TYPE_INT_1 = 1; public final static int TYPE_INT_2 = 2; public final static int TYPE_INT_3 = 3; public final static int TYPE_INT_4 = 4; public final static int TYPE_INT_5 = 5; public final static int TYPE_INT_6 = 6; /** * 對用戶類型的值轉換成為對應的int * @param str 需要轉換的用戶類型的值 * @return 對應的int的值 */ public static int typeStringToInt(String str){ if(str!=null && str.equals(TYPE_1)){ return TYPE_INT_1; }else if(str!=null && str.equals(TYPE_2)){ return TYPE_INT_2; }else if(str!=null && str.equals(TYPE_3)){ return TYPE_INT_3; }else if(str!=null && str.equals(TYPE_4)){ return TYPE_INT_4; }else if(str!=null && str.equals(TYPE_5)){ return TYPE_INT_5; }else if(str!=null && str.equals(TYPE_6)){ return TYPE_INT_6; } return 0; } /** * 對用戶類型的int值轉換成為對應的String * @param a 需要轉換的用戶類型的int值 * @return 對應的用戶類型的值 */ public static String typeIntToString(int a){ if(a == TYPE_INT_1){ return TYPE_1; }else if(a == TYPE_INT_2){ return TYPE_2; }else if(a == TYPE_INT_3){ return TYPE_3; }else if(a == TYPE_INT_4){ return TYPE_4; }else if(a == TYPE_INT_5){ return TYPE_5; }else if(a == TYPE_INT_6){ return TYPE_6; } return ""; } public UserModel(){ } public UserModel(String str){ String strs[] = str.split(","); this.id = strs[0]; this.name = strs[1]; this.type = Integer.parseInt(strs[2]); this.pwd = strs[3]; } public String getId() { return id; } public String getName() { return name; } public String getPwd() { return pwd; } public int getType() { return type; } public void setType(int type) { this.type = type; } public void setPwd(String pwd) { this.pwd = pwd; } public void setName(String name) { this.name = name; } public void setId(String id) { this.id = id; } public String toMyString(){ return id+","+name+","+type+","+pwd; } public String toString(){ return "id="+id+",name="+name+",type="+type+",pwd="+pwd; }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -