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 return bio != null ? bio.equals(that.bio)
56 : that.bio == null && favouriteSection == that.favouriteSection && theComplexImmutableAuthorId != null
57 ? theComplexImmutableAuthorId.equals(that.theComplexImmutableAuthorId)
58 : that.theComplexImmutableAuthorId == null;
59 }
60
61 @Override
62 public int hashCode() {
63 int myresult = theComplexImmutableAuthorId != null ? theComplexImmutableAuthorId.hashCode() : 0;
64 myresult = 31 * myresult + (bio != null ? bio.hashCode() : 0);
65 return 31 * myresult + (favouriteSection != null ? favouriteSection.hashCode() : 0);
66 }
67 }