salesorderlineitem.java

来自「Sample Hibernate Shopping Cart Applicati」· Java 代码 · 共 82 行

JAVA
82
字号
package org.simplecart.contract.salesorder;

import org.simplecart.shopcart.catalog.ProductOption;
import org.simplecart.base.Persistent;
import org.simplecart.contract.LineItem;

/**
 * An Internet LineItem does not maintain a reference to the SalesOrder that
 * owns it. This is intented to increase performance for web-based uses.
 */
public class SalesOrderLineItem  implements LineItem, Persistent {
    
    private Long id;
    private float quantity;
    private float unitPrice;
    private ProductOption option;
    private String comment;
    
    /**
     * Default no args constructor
     */
    public SalesOrderLineItem() {
    }
    
    /**
     * Full constructor
     *
     * @param quantity
     * @param unitCost
     * @param option
     */
    public SalesOrderLineItem(
            float quantity,
            float unitPrice,
            String comment,
            ProductOption option) {
        this.quantity = quantity;
        this.unitPrice = unitPrice;
        this.setComment(comment);
        this.option = option;
    }
    
    public Long getId() {
        return id;
    }
    
    public float getQuantity() {
        return quantity;
    }
    
    public void setQuantity(float quantity) {
        this.quantity = quantity;
    }
    
    public float getUnitPrice() {
        return unitPrice;
    }
    
    public void setUnitPrice(float unitCost) {
        this.unitPrice = unitCost;
    }
    
    public ProductOption getOption() {
        return option;
    }
    
    public void setOption(ProductOption option) {
        this.option = option;
    }
    
    public float getLineItemTotalCost() {
        return (this.unitPrice*this.quantity);
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }
}

⌨️ 快捷键说明

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