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 static final long serialVersionUID = 1L;
22 private final ComplexImmutableAuthorId theComplexImmutableAuthorId;
23 protected final String bio;
24 protected final Section favouriteSection;
25
26 public ComplexImmutableAuthor(ComplexImmutableAuthorId aComplexImmutableAuthorId, String bio, Section section) {
27 theComplexImmutableAuthorId = aComplexImmutableAuthorId;
28 this.bio = bio;
29 this.favouriteSection = section;
30 }
31
32 public ComplexImmutableAuthorId getComplexImmutableAuthorId() {
33 return theComplexImmutableAuthorId;
34 }
35
36 public String getBio() {
37 return bio;
38 }
39
40 public Section getFavouriteSection() {
41 return favouriteSection;
42 }
43
44 @Override
45 public boolean equals(Object o) {
46 if (this == o) {
47 return true;
48 }
49 if (o == null || getClass() != o.getClass()) {
50 return false;
51 }
52
53 final ComplexImmutableAuthor that = (ComplexImmutableAuthor) o;
54
55 if ((bio != null ? !bio.equals(that.bio) : that.bio != null) || (favouriteSection != that.favouriteSection)
56 || (theComplexImmutableAuthorId != null ? !theComplexImmutableAuthorId.equals(that.theComplexImmutableAuthorId)
57 : that.theComplexImmutableAuthorId != null)) {
58 return false;
59 }
60
61 return true;
62 }
63
64 @Override
65 public int hashCode() {
66 int myresult = theComplexImmutableAuthorId != null ? theComplexImmutableAuthorId.hashCode() : 0;
67 myresult = 31 * myresult + (bio != null ? bio.hashCode() : 0);
68 return 31 * myresult + (favouriteSection != null ? favouriteSection.hashCode() : 0);
69 }
70 }