1 package org.apache.ojb.tutorial1; 2 3 17 18 23 public class Product implements java.io.Serializable 24 { 25 31 private Integer id; 32 33 38 protected String name; 39 40 45 protected double price; 46 47 52 protected int stock; 53 54 59 public int getId() 60 { 61 return id.intValue(); 62 } 63 64 69 public String getName() 70 { 71 return name; 72 } 73 74 79 public double getPrice() 80 { 81 return price; 82 } 83 84 89 public int getStock() 90 { 91 return stock; 92 } 93 94 99 public void setId(int newId) 100 { 101 id = new Integer (newId); 102 } 103 104 109 public void setName(String newName) 110 { 111 name = newName; 112 } 113 114 119 public void setPrice(double newPrice) 120 { 121 price = newPrice; 122 } 123 124 129 public void setStock(int newStock) 130 { 131 stock = newStock; 132 } 133 134 139 public String toString() 140 { 141 return "[" + id + "] " + name + "\t\t\t price: " + price + "\t\t stock: " + stock; 142 } 143 } 144 | Popular Tags |