tradetype.java

来自「基于netbeans的java桌面应用程序合集」· Java 代码 · 共 56 行

JAVA
56
字号
package entities;

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity()
public class TradeType implements java.io.Serializable {
    
    @Id
    private int typeCode;
    
    private String description;
    
    public TradeType() {
    }
    public TradeType(int code) {
        this.typeCode = code;
    }    
    public TradeType(int code, String description){
        this.setTypeCode(code);
        this.setDescription(description);
    }
    
    public static TradeType BUY = new TradeType(1, "Buy");
    public static TradeType SELL = new TradeType(2, "Sell");
    
    public int getTypeCode() {
        return typeCode;
    }
    
    public void setTypeCode(int typeCode) {
        this.typeCode = typeCode;
    }
    
    public String getDescription() {
        return description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }

    public boolean equals(Object obj) {
        if(!(obj instanceof TradeType)){
            return false;
        }
        TradeType theType = (TradeType) obj;
        if(theType.getTypeCode() == getTypeCode()){
            return true;
        } else {
            return false;
        }
    }

}

⌨️ 快捷键说明

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