1 | package geniusweb.references;
|
---|
2 |
|
---|
3 | import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
---|
4 | import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
|
---|
5 | import com.fasterxml.jackson.annotation.JsonCreator;
|
---|
6 | import com.fasterxml.jackson.annotation.JsonProperty;
|
---|
7 |
|
---|
8 | @JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)
|
---|
9 | public class PartyWithProfile {
|
---|
10 | private final PartyWithParameters party;
|
---|
11 | private final ProfileRef profile;
|
---|
12 |
|
---|
13 | @JsonCreator
|
---|
14 | public PartyWithProfile(@JsonProperty("party") PartyWithParameters party,
|
---|
15 | @JsonProperty("profile") ProfileRef profile) {
|
---|
16 | if (party == null || profile == null) {
|
---|
17 | throw new IllegalArgumentException(
|
---|
18 | "party and profile must be not null");
|
---|
19 | }
|
---|
20 | this.party = party;
|
---|
21 | this.profile = profile;
|
---|
22 | }
|
---|
23 |
|
---|
24 | /**
|
---|
25 | *
|
---|
26 | * @return the {@link PartyWithParameters}. never null.
|
---|
27 | */
|
---|
28 | public PartyWithParameters getParty() {
|
---|
29 | return party;
|
---|
30 |
|
---|
31 | }
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * @return the profile setting for this party. Never null.
|
---|
35 | */
|
---|
36 | public ProfileRef getProfile() {
|
---|
37 | return profile;
|
---|
38 | }
|
---|
39 |
|
---|
40 | @Override
|
---|
41 | public String toString() {
|
---|
42 | return "PartyWithProfile[" + party + "," + profile + "]";
|
---|
43 | }
|
---|
44 |
|
---|
45 | @Override
|
---|
46 | public int hashCode() {
|
---|
47 | final int prime = 31;
|
---|
48 | int result = 1;
|
---|
49 | result = prime * result + ((party == null) ? 0 : party.hashCode());
|
---|
50 | result = prime * result + ((profile == null) ? 0 : profile.hashCode());
|
---|
51 | return result;
|
---|
52 | }
|
---|
53 |
|
---|
54 | @Override
|
---|
55 | public boolean equals(Object obj) {
|
---|
56 | if (this == obj)
|
---|
57 | return true;
|
---|
58 | if (obj == null)
|
---|
59 | return false;
|
---|
60 | if (getClass() != obj.getClass())
|
---|
61 | return false;
|
---|
62 | PartyWithProfile other = (PartyWithProfile) obj;
|
---|
63 | if (party == null) {
|
---|
64 | if (other.party != null)
|
---|
65 | return false;
|
---|
66 | } else if (!party.equals(other.party))
|
---|
67 | return false;
|
---|
68 | if (profile == null) {
|
---|
69 | if (other.profile != null)
|
---|
70 | return false;
|
---|
71 | } else if (!profile.equals(other.profile))
|
---|
72 | return false;
|
---|
73 | return true;
|
---|
74 | }
|
---|
75 | }
|
---|