internetassociatedproduct.java

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

JAVA
64
字号
/*
 * @(#)InternetAssociatedProduct.java $LastChangedRevision$ $LastChangedDate$
 * Created on Apr 5, 2005
 *
 * Copyright (c) 2005, Daniel Watrous
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or 
 * without modification, are governed by the license found in
 * the following places:
 * license.txt included with this distribution, or
 * http://www.simplecart.org/license.html
 * 
 */
package org.simplecart.shopcart.catalog;

import org.apache.log4j.Category;

/**
 * @version		$LastChangedRevision$ $LastChangedDate$
 * @author 		Daniel Watrous
 * 
 */
public class InternetAssociatedProduct extends InternetAssociation {
	
    private ProductCategory productCategory;
    private Product product;
    private static Category cat = Category.getInstance(InternetAssociatedProduct.class.getName());
    
    /**
     * No-arg constructor for JavaBean tools
     */
	InternetAssociatedProduct() {}
    
	/**
	 * Full constructor;
	 */
	public InternetAssociatedProduct(ProductCategory productCategory, Product product) {
	    this.productCategory = productCategory;
	    this.product = product;
	}
    
    // JavaBean style accessors/mutators
    public ProductCategory getProductCategory() {
        return productCategory;
    }

    public Product getProduct() {
        return product;
    }
    
    public boolean equals(Object obj) {
        cat.debug("Enter Equals method for InternetAssociatedProduct class.");
        if (this == obj) return true;
        InternetAssociatedProduct checkObj = (InternetAssociatedProduct) obj;
        cat.debug("Product in this: " + this.getProduct().getName());
        cat.debug("Product in checkObj: " + checkObj.getProduct().getName());
        cat.debug("ProductCategory in this: " + this.getProductCategory().getName());
        cat.debug("ProductCategory in checkObj: " + checkObj.getProductCategory().getName());
        if (this.product == checkObj.getProduct() && this.productCategory == checkObj.getProductCategory()) return true;
        return false;
    }
}

⌨️ 快捷键说明

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