1 | package geniusweb.partiesserver.repository;
|
---|
2 |
|
---|
3 | import java.net.URI;
|
---|
4 |
|
---|
5 | import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
---|
6 | import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
|
---|
7 |
|
---|
8 | import geniusweb.party.Capabilities;
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * Contains general info about party that can be collected from a party after it
|
---|
12 | * was instantiated
|
---|
13 | */
|
---|
14 | @JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)
|
---|
15 | public class GeneralPartyInfo {
|
---|
16 | private final URI uri;
|
---|
17 | private final Capabilities capabilities;
|
---|
18 | private final String description;
|
---|
19 |
|
---|
20 | private GeneralPartyInfo() {
|
---|
21 | uri = null;
|
---|
22 | capabilities = null;
|
---|
23 | description = null;
|
---|
24 | }
|
---|
25 |
|
---|
26 | public GeneralPartyInfo(URI iri, Capabilities caps, String descr) {
|
---|
27 | this.uri = iri;
|
---|
28 | this.capabilities = caps;
|
---|
29 | this.description = descr;
|
---|
30 | }
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * @return the URI used to create a new instance of this party.
|
---|
34 | */
|
---|
35 | public URI getURI() {
|
---|
36 | return uri;
|
---|
37 | }
|
---|
38 |
|
---|
39 | public Capabilities getCapabilities() {
|
---|
40 | return capabilities;
|
---|
41 | }
|
---|
42 |
|
---|
43 | public String getDescription() {
|
---|
44 | return description;
|
---|
45 | }
|
---|
46 |
|
---|
47 | @Override
|
---|
48 | public int hashCode() {
|
---|
49 | final int prime = 31;
|
---|
50 | int result = 1;
|
---|
51 | result = prime * result
|
---|
52 | + ((capabilities == null) ? 0 : capabilities.hashCode());
|
---|
53 | result = prime * result
|
---|
54 | + ((description == null) ? 0 : description.hashCode());
|
---|
55 | result = prime * result + ((uri == null) ? 0 : uri.hashCode());
|
---|
56 | return result;
|
---|
57 | }
|
---|
58 |
|
---|
59 | @Override
|
---|
60 | public boolean equals(Object obj) {
|
---|
61 | if (this == obj)
|
---|
62 | return true;
|
---|
63 | if (obj == null)
|
---|
64 | return false;
|
---|
65 | if (getClass() != obj.getClass())
|
---|
66 | return false;
|
---|
67 | GeneralPartyInfo other = (GeneralPartyInfo) obj;
|
---|
68 | if (capabilities == null) {
|
---|
69 | if (other.capabilities != null)
|
---|
70 | return false;
|
---|
71 | } else if (!capabilities.equals(other.capabilities))
|
---|
72 | return false;
|
---|
73 | if (description == null) {
|
---|
74 | if (other.description != null)
|
---|
75 | return false;
|
---|
76 | } else if (!description.equals(other.description))
|
---|
77 | return false;
|
---|
78 | if (uri == null) {
|
---|
79 | if (other.uri != null)
|
---|
80 | return false;
|
---|
81 | } else if (!uri.equals(other.uri))
|
---|
82 | return false;
|
---|
83 | return true;
|
---|
84 | }
|
---|
85 |
|
---|
86 | @Override
|
---|
87 | public String toString() {
|
---|
88 | return "GeneralPartyInfo[" + uri + "," + capabilities + ","
|
---|
89 | + description + "]";
|
---|
90 | }
|
---|
91 |
|
---|
92 | }
|
---|