KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > broker > Salad


1 package org.apache.ojb.broker;
2
3 import java.io.Serializable JavaDoc;
4
5 /**
6  * @author <a HREF="mailto:schneider@mendel.imp.univie.ac.at">Georg Schneider</a>
7  *
8  */

9 public class Salad implements InterfaceFood, Serializable JavaDoc
10 {
11
12     int foodId;
13     String JavaDoc name;
14     int calories;
15     String JavaDoc color;
16     /**
17      * Constructor for Salad.
18      */

19     public Salad()
20     {
21         super();
22     }
23     
24     public Salad(String JavaDoc name, int calories, String JavaDoc color)
25     {
26         this.name = name;
27         this.calories = calories;
28         this.color = color;
29     }
30
31     /**
32      * @see org.apache.ojb.broker.InterfaceFood#getName()
33      */

34     public String JavaDoc getName()
35     {
36         return name;
37     }
38
39     /**
40      * @see org.apache.ojb.broker.InterfaceFood#getCalories()
41      */

42     public int getCalories()
43     {
44         return calories;
45     }
46
47
48
49     /**
50      * Returns the color.
51      * @return String
52      */

53     public String JavaDoc getColor()
54     {
55         return color;
56     }
57
58     /**
59      * Returns the foodId.
60      * @return int
61      */

62     public int getFoodId()
63     {
64         return foodId;
65     }
66     
67     public String JavaDoc toString()
68     {
69        return "Salad: id = " + foodId + "\n name = " + name +
70                 "\n calories = " + calories +
71                 "\n Color = " + color;
72     }
73
74     /**
75      * Sets the calories.
76      * @param calories The calories to set
77      */

78     public void setCalories(int calories)
79     {
80         this.calories = calories;
81     }
82
83     /**
84      * Sets the color.
85      * @param color The color to set
86      */

87     public void setColor(String JavaDoc color)
88     {
89         this.color = color;
90     }
91
92     /**
93      * Sets the foodId.
94      * @param foodId The foodId to set
95      */

96     public void setFoodId(int foodId)
97     {
98         this.foodId = foodId;
99     }
100
101     /**
102      * Sets the name.
103      * @param name The name to set
104      */

105     public void setName(String JavaDoc name)
106     {
107         this.name = name;
108     }
109
110 }
111
Popular Tags