category.java

来自「基于Struts的网络商店源码。使用Hibernate技术」· Java 代码 · 共 152 行

JAVA
152
字号
package com.sush.webstore.store.domain.beans;

import java.util.HashSet;
import java.util.Set;

import com.sush.webstore.store.domain.ICategory;
import com.sush.webstore.store.domain.IImages;

public class Category implements ICategory {

	private long id;

	private String name;

	private String description;

	private Set<Product> products = new HashSet<Product>();

	private Images images = new Images();

	private Category supCategory;

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

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

	/**
	 * @return the id
	 */
	public long getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	private void setId(long id) {
		this.id = id;
	}

	/**
	 * @return the products
	 */
	public Set<Product> getProducts() {
		return products;
	}

	/**
	 * @param products
	 *            the products to set
	 */
	public void setProducts(Set<Product> products) {
		this.products = products;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the supCategory
	 */
	public Category getSupCategory() {
		return supCategory;
	}

	/**
	 * @param supCategory
	 *            the supCategory to set
	 */
	public void setSupCategory(Category supCategory) {
		this.supCategory = supCategory;
	}

	public void addProduct(Product product) {
		this.products.add(product);
	}

	public void removeProduct(Product product) {
		this.products.remove(product);
	}

	/**
	 * @return the images
	 */
	public IImages getIImages() {
		return images;
	}

	/**
	 * @param images
	 *            the images to set
	 */
	public void setImages(Images images) {
		this.images = images;
	}

	/**
	 * @return the images
	 */
	public Images getImages() {
		return images;
	}

	
	// @Override
	// public boolean equals(Object obj) {
	//
	// if (this == obj)
	// return true;
	//
	// if (this.getClass() != obj.getClass())
	// return false;
	//
	// Category objP = (Category) obj;
	//
	// return (objP.id == this.id) ? true : false;
	// }
	//
	// @Override
	// public int hashCode() {
	//
	// int hash = 7;
	// hash = hash * 31 + new Integer(Long.toString(id));
	// ;
	// return hash;
	// }
}

⌨️ 快捷键说明

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