KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > data > Course


1 package org.jboss.cache.data;
2
3 /**
4  * @author Brian Stansberry
5  */

6 public class Course implements java.io.Serializable JavaDoc {
7    protected String JavaDoc title;
8    protected String JavaDoc instructor;
9    protected String JavaDoc room;
10
11    public void setTitle(String JavaDoc title)
12    {
13       this.title = title;
14    }
15
16    public String JavaDoc getTitle()
17    {
18       return this.title;
19    }
20
21    public void setRoom(String JavaDoc room)
22    {
23       this.room = room;
24    }
25
26    public String JavaDoc getRoom()
27    {
28       return this.room;
29    }
30    
31    public void setInstructor(String JavaDoc instructor)
32    {
33       this.instructor = instructor;
34    }
35    
36    public String JavaDoc getInstructor()
37    {
38       return instructor;
39    }
40
41    public String JavaDoc toString()
42    {
43       StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
44       buf.append("{Title = " +title).append(", Instructor = " + instructor).append(", Room = " +room + "}\n");
45
46       return buf.toString();
47    }
48    
49    public boolean equals(Object JavaDoc other)
50    {
51       if (this == other)
52          return true;
53          
54       if (other instanceof Course) {
55          String JavaDoc otherTitle = ((Course) other).getTitle();
56          return (title == otherTitle || (title != null && title.equals(otherTitle)));
57       }
58       
59       return false;
60    }
61    
62    public int hashCode()
63    {
64       return title == null ? 0 : title.hashCode();
65    }
66 }
67
Popular Tags