KickJava   Java API By Example, From Geeks To Geeks.

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


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

11 public class Fish implements InterfaceFood, Serializable JavaDoc
12 {
13     int foodId;
14     String JavaDoc name;
15     int calories;
16     String JavaDoc typeOfWater;
17
18     /**
19      * Constructor for Fish.
20      */

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

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

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

55     public String JavaDoc getTypeOfWater()
56     {
57         return typeOfWater;
58     }
59
60     /**
61      * Returns the foodId.
62      * @return int
63      */

64     public int getFoodId()
65     {
66         return foodId;
67     }
68     
69     public String JavaDoc toString()
70     {
71        return "Fish: id = " + foodId + "\n name = " + name +
72                 "\n calories = " + calories +
73                 "\n Type of water = " + typeOfWater;
74     }
75
76
77     /**
78      * Sets the calories.
79      * @param calories The calories to set
80      */

81     public void setCalories(int calories)
82     {
83         this.calories = calories;
84     }
85
86     /**
87      * Sets the foodId.
88      * @param foodId The foodId to set
89      */

90     public void setFoodId(int foodId)
91     {
92         this.foodId = foodId;
93     }
94
95     /**
96      * Sets the name.
97      * @param name The name to set
98      */

99     public void setName(String JavaDoc name)
100     {
101         this.name = name;
102     }
103
104     /**
105      * Sets the typeOfWater.
106      * @param typeOfWater The typeOfWater to set
107      */

108     public void setTypeOfWater(String JavaDoc typeOfWater)
109     {
110         this.typeOfWater = typeOfWater;
111     }
112
113 }
114
Popular Tags