FileDocCategorySizeDatePackage
Stock.javaAPI DocExample2045Fri Mar 01 11:27:38 GMT 2002javajaxb.po

Stock.java

package javajaxb.po;

/**
 * <p>
 *  The <code>Stock</code> class represents the quantity
 *    portion of an <code>{@link Order}</code> object.
 * </p>
 */
public class Stock {

    /** Whether the stock should be kept on hand */
    private boolean onHand;

    /** The number to order */
    private int quantity;
    
    /**
     * <p>
     *  Default constructor for Quick.
     * </p>
     */
    public Stock() { }

    /**
     * <p>
     *  Set up defaults.
     * </p>
     *
     * @param quantity the number to stock
     */
    public Stock(int quantity) {
        this(quantity, true);
    }
    
    /**
     * <p>
     *  Additional constructor to allow setting of whether
     *    or not to keep stock on hand.
     * </p>
     *
     * @param quantity the number to stock
     * @param onHand whether to keep the stock on hand.
     */
    public Stock(int quantity, boolean onHand) {
        this.quantity = quantity;
        this.onHand = onHand;
    }

    /**
     * <p>
     *  This returns the current status of whether the
     *    stock should be kept on hand.
     * </p>
     *
     * @return <code>boolean</code> - whether stock is on hand.
     */
    public boolean getOnHand() {
        return onHand;
    }

    /**
     * <p>
     *  This sets whether or not to keep the ordered
     *    stock on hand.
     * </p>
     *
     * @param onHand whether to keep stock on hand.
     */
    public void setOnHand(boolean onHand) {
        this.onHand = onHand;
    }

    /**
     * <p>
     *  This returns the number ordered of this stock
     * </p>
     *
     * @return <code>int</code> - the quantity ordered.
     */
    public int getQuantity() {
        return quantity;
    }

    /**
     * <p>
     *  This sets the number of this stock to order.
     * </p>
     *
     * @param quantity the number to order.
     */
    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

}