Update license to GPLv3, fix header comments
[jFCPlib.git] / src / main / java / net / pterodactylus / fcp / plugin / Identity.java
1 /*
2  * jFCPlib - Identity.java - Copyright © 2009–2016 David Roden
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 package net.pterodactylus.fcp.plugin;
19
20 /**
21  * Wrapper around a web-of-trust identity.
22  *
23  * @author David ‘Bombe’ Roden &lt;bombe@freenetproject.org&gt;
24  */
25 public class Identity {
26
27         /** The identity’s identifier. */
28         private final String identifier;
29
30         /** The identity’s nickname. */
31         private final String nickname;
32
33         /** The identity’s request URI. */
34         private final String requestUri;
35
36         /**
37          * Creates a new identity.
38          *
39          * @param identifier
40          *            The identifies of the identity
41          * @param nickname
42          *            The nickname of the identity
43          * @param requestUri
44          *            The request URI of the identity
45          */
46         public Identity(String identifier, String nickname, String requestUri) {
47                 this.identifier = identifier;
48                 this.nickname = nickname;
49                 this.requestUri = requestUri;
50         }
51
52         /**
53          * Returns the identifier of this identity.
54          *
55          * @return This identity’s identifier
56          */
57         public String getIdentifier() {
58                 return identifier;
59         }
60
61         /**
62          * Returns the nickname of this identity.
63          *
64          * @return This identity’s nickname
65          */
66         public String getNickname() {
67                 return nickname;
68         }
69
70         /**
71          * Returns the request URI of this identity.
72          *
73          * @return This identity’s request URI
74          */
75         public String getRequestUri() {
76                 return requestUri;
77         }
78
79         /**
80          * {@inheritDoc}
81          */
82         @Override
83         public boolean equals(Object obj) {
84                 if ((obj == null) || (obj.getClass() != this.getClass())) {
85                         return false;
86                 }
87                 Identity identity = (Identity) obj;
88                 return identifier.equals(identity.identifier);
89         }
90
91         /**
92          * {@inheritDoc}
93          */
94         @Override
95         public int hashCode() {
96                 return identifier.hashCode();
97         }
98
99 }