⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 funddto.java

📁 EJB+Struts+Webservice实现的开放式基金管理系统
💻 JAVA
字号:
package com.fund.fund;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Random;

/**
 *
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2005</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class FundDto implements Serializable {
    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 1L;
    /**
     *
     */
    private Integer fundNo;
    /**
     *
     */
    private String fundName;
    /**
     *
     */
    private Double price;
    /**
     *
     */
    private String description;
    /**
     *
     */
    private String status;
    /**
     *
     */
    private Timestamp createdDate;
    /**
     *
     * @return Integer
     */
    public Integer getFundNo() {
        return fundNo;
    }

    /**
     *
     * @param fundNo Integer
     */
    public void setFundNo(Integer fundNo) {
        this.fundNo = fundNo;
    }

    /**
     *
     * @return String
     */
    public String getFundName() {
        return fundName;
    }

    /**
     *
     * @param fundName String
     */
    public void setFundName(String fundName) {
        this.fundName = fundName.toUpperCase();
    }

    /**
     *
     * @return Double
     */
    public Double getPrice() {
        if (price != null) {
            java.text.DecimalFormat obDF = new java.text.DecimalFormat("#.##");
            return new Double(obDF.format(price));
        } else {
            return price;
        }
    }

    /**
     *
     * @return Double
     */
    public Double getCurrentPrice() {
        int randomNo = pickNumberInRange(-10, 10);
        double currentPrice = price.doubleValue()
                              * (1 + (double) randomNo / (double) 100);
        java.text.DecimalFormat obDF = new java.text.DecimalFormat("#.##");
        return new Double(obDF.format(currentPrice));
    }

    /**
     *
     * @param aLowerLimit int
     * @param aUpperLimit int
     * @return int
     */
    private int pickNumberInRange(int aLowerLimit, int aUpperLimit) {
        Random generator = new Random();
        long range = (long) aUpperLimit - (long) aLowerLimit + 1;
        long fraction = (long) (range * generator.nextDouble());
        return (int) (fraction + aLowerLimit);
    }


    /**
     *
     * @param price Double
     */
    public void setPrice(Double price) {
        java.text.DecimalFormat obDF = new java.text.DecimalFormat("#.##");
        this.price = new Double(obDF.format(price));
//        this.price = price;
    }

    /**
     *
     * @return String
     */
    public String getDescription() {
        return description;
    }

    /**
     *
     * @param description String
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     *
     * @return String
     */
    public String getStatus() {
        return status;
    }

    /**
     *
     * @param status String
     */
    public void setStatus(String status) {
        this.status = status;
    }

    /**
     *
     * @return Timestamp
     */
    public Timestamp getCreatedDate() {
        return createdDate;
    }

    /**
     *
     * @param createdDate Timestamp
     */
    public void setCreatedDate(Timestamp createdDate) {
        this.createdDate = createdDate;
    }


    /**
     *
     * @param obj Object
     * @return boolean
     */
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof FundDto)) {
            return false;
        }
        FundDto that = (FundDto) obj;
        if (!(that.fundNo == null ? this.fundNo == null
              :
              that.fundNo.equals(this.fundNo))) {
            return false;
        }
        if (!(that.fundName == null ? this.fundName == null
              :
              that.fundName.equals(this.fundName))) {
            return false;
        }
        if (!(that.price == null ? this.price == null
              :
              that.price.equals(this.price))) {
            return false;
        }
        if (!(that.description == null ? this.description == null
              :
              that.description.equals(this.description))) {
            return false;
        }
        if (!(that.status == null ? this.status == null
              :
              that.status.equals(this.status))) {
            return false;
        }
        if (!(that.createdDate == null ? this.createdDate == null
              :
              that.createdDate.equals(this.createdDate))) {
            return false;
        }
        return true;
    }

    /**
     *
     * @return int
     */
    public int hashCode() {
        int result = 17;
        result = 37 * result + this.fundNo.hashCode();
        result = 37 * result + this.fundName.hashCode();
        result = 37 * result + this.price.hashCode();
        result = 37 * result + this.description.hashCode();
        result = 37 * result + this.status.hashCode();
        result = 37 * result + this.createdDate.hashCode();
        return result;
    }

    /**
     *
     * @return String
     */
    public String toString() {
        String returnString = "";
        returnString += "FUND NUMBER:" + fundNo;
        returnString += " FUND NAME:" + fundName;
        returnString += " PRICE:" + price;
        returnString += " DESCRIPTION:" + description;
        returnString += " STATUS:" + status;
        returnString += " CREATED DATE:" + createdDate;
        return returnString;
    }

    /**
     *
     * @param msg String
     * @return String
     */
    public String logData(String msg) {
        String returnString = "\n[" + msg.toUpperCase() + "]\n";
        returnString += toString() + "\n";
        return returnString;
    }
}

⌨️ 快捷键说明

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