1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.domain.blog;
17
18 public class ComplexImmutableAuthorId {
19 protected final int id;
20 protected final String email;
21 protected final String username;
22 protected final String password;
23
24 public ComplexImmutableAuthorId(int aId, String aEmail, String aUsername, String aPassword) {
25 id = aId;
26 email = aEmail;
27 username = aUsername;
28 password = aPassword;
29 }
30
31 public int getId() {
32 return id;
33 }
34
35 public String getEmail() {
36 return email;
37 }
38
39 public String getUsername() {
40 return username;
41 }
42
43 public String getPassword() {
44 return password;
45 }
46
47 @Override
48 public boolean equals(Object o) {
49 if (this == o) {
50 return true;
51 }
52 if (o == null || getClass() != o.getClass()) {
53 return false;
54 }
55
56 final ComplexImmutableAuthorId that = (ComplexImmutableAuthorId) o;
57
58 if ((id != that.id) || (email != null ? !email.equals(that.email) : that.email != null)
59 || (password != null ? !password.equals(that.password) : that.password != null)
60 || (username != null ? !username.equals(that.username) : that.username != null)) {
61 return false;
62 }
63
64 return true;
65 }
66
67 @Override
68 public int hashCode() {
69 int myresult = id;
70 myresult = 31 * myresult + (email != null ? email.hashCode() : 0);
71 myresult = 31 * myresult + (username != null ? username.hashCode() : 0);
72 return 31 * myresult + (password != null ? password.hashCode() : 0);
73 }
74 }