equal
deleted
inserted
replaced
|
1 /* |
|
2 * otr4j, the open source java otr library. |
|
3 * |
|
4 * Distributable under LGPL license. |
|
5 * See terms of license at gnu.org. |
|
6 */ |
|
7 package net.java.otr4j.io.messages; |
|
8 |
|
9 /** |
|
10 * |
|
11 * @author George Politis |
|
12 */ |
|
13 public class ErrorMessage extends AbstractMessage { |
|
14 // Fields. |
|
15 public String error; |
|
16 |
|
17 // Ctor. |
|
18 public ErrorMessage(int messageType, String error) { |
|
19 super(messageType); |
|
20 this.error = error; |
|
21 } |
|
22 |
|
23 // Methods. |
|
24 @Override |
|
25 public int hashCode() { |
|
26 final int prime = 31; |
|
27 int result = super.hashCode(); |
|
28 result = prime * result + ((error == null) ? 0 : error.hashCode()); |
|
29 return result; |
|
30 } |
|
31 |
|
32 @Override |
|
33 public boolean equals(Object obj) { |
|
34 if (this == obj) |
|
35 return true; |
|
36 if (!super.equals(obj)) |
|
37 return false; |
|
38 if (getClass() != obj.getClass()) |
|
39 return false; |
|
40 ErrorMessage other = (ErrorMessage) obj; |
|
41 if (error == null) { |
|
42 if (other.error != null) |
|
43 return false; |
|
44 } else if (!error.equals(other.error)) |
|
45 return false; |
|
46 return true; |
|
47 } |
|
48 } |