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