Product.java
01 /**
02  *
03  * All content copyright (c) 2003-2008 Terracotta, Inc.,
04  * except as may otherwise be noted in a separate copyright notice.
05  * All rights reserved.
06  *
07  */
08 package demo.inventory;
09 
10 /**
11  *  Description of the Class
12  *
13  *@author    Terracotta, Inc.
14  */
15 public class Product {
16    private double price;
17    private final String name;
18    private final String sku;
19 
20    public Product(String n, double p, String s) {
21       name = n;
22       price = p;
23       sku = s;
24    }
25 
26    public synchronized void setPrice(double p) {
27       price = p;
28    }
29 
30    public final String getName() {
31       return name;
32    }
33 
34    public final String getSKU() {
35       return sku;
36    }
37 
38    public synchronized double getPrice() {
39       return price;
40    }
41 
42    public int hashCode() {
43       return sku.hashCode();
44    }
45 }