| 1 | |
package org.jtheque.core.managers.message; |
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
import org.jtheque.utils.Constants; |
| 20 | |
import org.jtheque.utils.bean.EqualsUtils; |
| 21 | |
import org.jtheque.utils.bean.IntDate; |
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | 0 | public final class Message implements Comparable<Message> { |
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
private int id; |
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
private String title; |
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
private String message; |
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
private IntDate date; |
| 46 | |
|
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | |
private String source; |
| 51 | |
|
| 52 | |
|
| 53 | |
|
| 54 | |
|
| 55 | |
|
| 56 | |
|
| 57 | |
public int getId() { |
| 58 | 0 | return id; |
| 59 | |
} |
| 60 | |
|
| 61 | |
|
| 62 | |
|
| 63 | |
|
| 64 | |
|
| 65 | |
|
| 66 | |
public void setId(int id) { |
| 67 | 0 | this.id = id; |
| 68 | 0 | } |
| 69 | |
|
| 70 | |
|
| 71 | |
|
| 72 | |
|
| 73 | |
|
| 74 | |
|
| 75 | |
public String getTitle() { |
| 76 | 0 | return title; |
| 77 | |
} |
| 78 | |
|
| 79 | |
|
| 80 | |
|
| 81 | |
|
| 82 | |
|
| 83 | |
|
| 84 | |
public void setTitle(String title) { |
| 85 | 0 | this.title = title; |
| 86 | 0 | } |
| 87 | |
|
| 88 | |
|
| 89 | |
|
| 90 | |
|
| 91 | |
|
| 92 | |
|
| 93 | |
public String getMessage() { |
| 94 | 0 | return message; |
| 95 | |
} |
| 96 | |
|
| 97 | |
|
| 98 | |
|
| 99 | |
|
| 100 | |
|
| 101 | |
|
| 102 | |
public void setMessage(String message) { |
| 103 | 0 | this.message = message; |
| 104 | 0 | } |
| 105 | |
|
| 106 | |
|
| 107 | |
|
| 108 | |
|
| 109 | |
|
| 110 | |
|
| 111 | |
public IntDate getDate() { |
| 112 | 0 | return date; |
| 113 | |
} |
| 114 | |
|
| 115 | |
|
| 116 | |
|
| 117 | |
|
| 118 | |
|
| 119 | |
|
| 120 | |
public void setDate(IntDate date) { |
| 121 | 0 | this.date = date; |
| 122 | 0 | } |
| 123 | |
|
| 124 | |
|
| 125 | |
|
| 126 | |
|
| 127 | |
|
| 128 | |
|
| 129 | |
public String getSource() { |
| 130 | 0 | return source; |
| 131 | |
} |
| 132 | |
|
| 133 | |
|
| 134 | |
|
| 135 | |
|
| 136 | |
|
| 137 | |
|
| 138 | |
public void setSource(String source) { |
| 139 | 0 | this.source = source; |
| 140 | 0 | } |
| 141 | |
|
| 142 | |
@Override |
| 143 | |
public String toString() { |
| 144 | 0 | return "Message{" + |
| 145 | |
"id=" + id + |
| 146 | |
", title='" + title + '\'' + |
| 147 | |
", message='" + message + '\'' + |
| 148 | |
", date=" + date + |
| 149 | |
", source='" + source + '\'' + |
| 150 | |
'}'; |
| 151 | |
} |
| 152 | |
|
| 153 | |
@Override |
| 154 | |
public boolean equals(Object o) { |
| 155 | 0 | if (EqualsUtils.areObjectIncompatible(this, o)) { |
| 156 | 0 | return false; |
| 157 | |
} |
| 158 | |
|
| 159 | 0 | Message other = (Message) o; |
| 160 | |
|
| 161 | 0 | if (EqualsUtils.areNotEquals(id, other.id)) { |
| 162 | 0 | return false; |
| 163 | |
} |
| 164 | |
|
| 165 | 0 | if (EqualsUtils.areNotEquals(date, other.date)) { |
| 166 | 0 | return false; |
| 167 | |
} |
| 168 | |
|
| 169 | 0 | if (EqualsUtils.areNotEquals(message, other.message)) { |
| 170 | 0 | return false; |
| 171 | |
} |
| 172 | |
|
| 173 | 0 | if (EqualsUtils.areNotEquals(source, other.source)) { |
| 174 | 0 | return false; |
| 175 | |
} |
| 176 | |
|
| 177 | 0 | return !EqualsUtils.areNotEquals(title, other.title); |
| 178 | |
} |
| 179 | |
|
| 180 | |
@Override |
| 181 | |
public int hashCode() { |
| 182 | 0 | int result = Constants.HASH_CODE_START; |
| 183 | |
|
| 184 | 0 | result = Constants.HASH_CODE_PRIME * result + id; |
| 185 | 0 | result = Constants.HASH_CODE_PRIME * result + title.hashCode(); |
| 186 | 0 | result = Constants.HASH_CODE_PRIME * result + message.hashCode(); |
| 187 | 0 | result = Constants.HASH_CODE_PRIME * result + date.hashCode(); |
| 188 | 0 | result = Constants.HASH_CODE_PRIME * result + source.hashCode(); |
| 189 | |
|
| 190 | 0 | return result; |
| 191 | |
} |
| 192 | |
|
| 193 | |
@Override |
| 194 | |
public int compareTo(Message o) { |
| 195 | 0 | return date.compareTo(o.date); |
| 196 | |
} |
| 197 | |
} |