KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > crazybob > rss > Item


1 package org.crazybob.rss;
2
3 /**
4  * Item.
5  *
6  * @author Bob Lee (crazybob@crazybob.org)
7  */

8 public class Item implements java.io.Serializable JavaDoc {
9     
10     static final long serialVersionUID = -1;
11
12     private String JavaDoc title;
13     private String JavaDoc description;
14     private String JavaDoc link;
15
16     public String JavaDoc toString() {
17         return "Item[" +
18             "title: " + this.title +
19             ", link: " + this.link +
20             ", description: " + this.description +
21             "]";
22     }
23     
24     public int hashCode() {
25         String JavaDoc title = (this.title == null) ? "" : this.title.trim();
26         String JavaDoc description = (this.description == null) ? "" :
27             this.description.trim();
28         return title.hashCode() * 37 + description.hashCode();
29     }
30
31     public boolean equals(Object JavaDoc o) {
32         Item i = (Item) o;
33         String JavaDoc title = (this.title == null) ? "" : this.title.trim();
34         String JavaDoc description = (this.description == null) ? "" :
35             this.description.trim();
36         String JavaDoc iTitle = (i.title == null) ? "" : i.title.trim();
37         String JavaDoc iDescription = (i.description == null) ? "" :
38             i.description.trim();
39         return title.equals(iTitle) && description.equals(iDescription);
40     }
41
42     /**
43      * Get title.
44      *
45      * @return title as String.
46      */

47     public String JavaDoc getTitle() {
48         return title;
49     }
50
51     /**
52      * Set title.
53      *
54      * @param title the value to set.
55      */

56     public void setTitle(String JavaDoc title) {
57         this.title = title;
58     }
59
60     /**
61      * Get description.
62      *
63      * @return description as String.
64      */

65     public String JavaDoc getDescription() {
66         return description;
67     }
68
69     /**
70      * Set description.
71      *
72      * @param description the value to set.
73      */

74     public void setDescription(String JavaDoc description) {
75         this.description = description;
76     }
77
78     /**
79      * Get link.
80      *
81      * @return link as String.
82      */

83     public String JavaDoc getLink() {
84         return link;
85     }
86
87     /**
88      * Set link.
89      *
90      * @param link the value to set.
91      */

92     public void setLink(String JavaDoc link) {
93         this.link = link;
94     }
95 }
96
Popular Tags