1 16 17 package info.jtrac.domain; 18 19 import java.io.Serializable ; 20 21 28 public class ItemTag implements Serializable { 29 30 private long id; 31 private Tag tag; 32 private int type; 33 34 public ItemTag() { 35 } 37 38 public ItemTag(Tag tag) { 39 this.tag = tag; 40 } 41 42 public ItemTag(Tag tag, int type) { 43 this.tag = tag; 44 this.type = type; 45 } 46 47 49 public long getId() { 50 return id; 51 } 52 53 public void setId(long id) { 54 this.id = id; 55 } 56 57 public Tag getTag() { 58 return tag; 59 } 60 61 public void setTag(Tag tag) { 62 this.tag = tag; 63 } 64 65 public int getType() { 66 return type; 67 } 68 69 public void setType(int type) { 70 this.type = type; 71 } 72 73 @Override 74 public String toString() { 75 StringBuffer sb = new StringBuffer (); 76 sb.append("id [").append(id); 77 sb.append("]; tag [").append(tag); 78 sb.append("]; type [").append(type); 79 sb.append("]"); 80 return sb.toString(); 81 } 82 83 @Override 84 public boolean equals(Object o) { 85 if (this == o) { 86 return true; 87 } 88 if (!(o instanceof ItemTag)) { 89 return false; 90 } 91 final ItemTag it = (ItemTag) o; 92 return (tag.equals(it.getTag()) && type == it.getType()); 93 } 94 95 @Override 96 public int hashCode() { 97 int hash = 7; 98 hash = hash * 31 + tag.hashCode(); 99 hash = hash * 31 + type; 100 return hash; 101 } 102 103 } 104 | Popular Tags |