1 package org.crazybob.rss; 2 3 8 public class Item implements java.io.Serializable { 9 10 static final long serialVersionUID = -1; 11 12 private String title; 13 private String description; 14 private String link; 15 16 public String 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 title = (this.title == null) ? "" : this.title.trim(); 26 String description = (this.description == null) ? "" : 27 this.description.trim(); 28 return title.hashCode() * 37 + description.hashCode(); 29 } 30 31 public boolean equals(Object o) { 32 Item i = (Item) o; 33 String title = (this.title == null) ? "" : this.title.trim(); 34 String description = (this.description == null) ? "" : 35 this.description.trim(); 36 String iTitle = (i.title == null) ? "" : i.title.trim(); 37 String iDescription = (i.description == null) ? "" : 38 i.description.trim(); 39 return title.equals(iTitle) && description.equals(iDescription); 40 } 41 42 47 public String getTitle() { 48 return title; 49 } 50 51 56 public void setTitle(String title) { 57 this.title = title; 58 } 59 60 65 public String getDescription() { 66 return description; 67 } 68 69 74 public void setDescription(String description) { 75 this.description = description; 76 } 77 78 83 public String getLink() { 84 return link; 85 } 86 87 92 public void setLink(String link) { 93 this.link = link; 94 } 95 } 96 | Popular Tags |