keyunit.java

来自「cwbbs 云网论坛源码」· Java 代码 · 共 79 行

JAVA
79
字号
package cn.js.fan.db;import java.io.Serializable;public class KeyUnit implements Serializable,Cloneable {        public KeyUnit(int type) {        this.type = type;    }    public KeyUnit(Object value) {        if (value instanceof Integer)            this.type = PrimaryKey.TYPE_INT;        else if (value instanceof String) {            this.type = PrimaryKey.TYPE_STRING;        }        else if (value instanceof Long) {            this.type = PrimaryKey.TYPE_LONG;        }        this.value = value;    }        public KeyUnit(int type, int orders) {        this.type = type;        this.orders = orders;    }        public Object clone() {        KeyUnit o = null;        try {            o = (KeyUnit)super.clone();        } catch (CloneNotSupportedException e) {            e.printStackTrace();        }        return o;    }    public void setType(int type) {        this.type = type;    }    public void setValue(Object value) {        this.value = value;    }    public String getStrValue() {        if (type==PrimaryKey.TYPE_STRING)            return (String)value;        else if (type==PrimaryKey.TYPE_INT)            return "" + ((Integer)value).intValue();        else if (type==PrimaryKey.TYPE_LONG)            return "" + ((Long)value).longValue();        else            return null;    }    public int getType() {        return type;    }    public Object getValue() {        return value;    }    public int getOrders() {        return orders;    }    public void setOrders(int orders) {        this.orders = orders;    }    private int type;    private Object value;    private int orders;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?