2 * Sone - Identity.java - Copyright © 2010 David Roden
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.
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.
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/>.
18 package net.pterodactylus.wotns.freenet.wot;
24 * Interface for web of trust identities, defining all functions that can be
25 * performed on an identity. The identity is the main entry point for identity
28 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
30 public interface Identity {
33 * Returns the ID of the identity.
35 * @return The ID of the identity
37 public String getId();
40 * Returns the nickname of the identity.
42 * @return The nickname of the identity
44 public String getNickname();
47 * Returns the request URI of the identity.
49 * @return The request URI of the identity
51 public String getRequestUri();
54 * Returns all contexts of this identity.
56 * @return All contexts of this identity
58 public Set<String> getContexts();
61 * Returns whether this identity has the given context.
64 * The context to check for
65 * @return {@code true} if this identity has the given context,
66 * {@code false} otherwise
68 public boolean hasContext(String context);
71 * Returns all properties of this identity.
73 * @return All properties of this identity
75 public Map<String, String> getProperties();
78 * Returns the value of the property with the given name.
81 * The name of the property
82 * @return The value of the property
84 public String getProperty(String name);
87 * Retrieves the trust that this identity receives from the given own
88 * identity. If this identity is not in the own identity’s trust tree, a
89 * {@link Trust} is returned that has all its elements set to {@code null}.
90 * If the trust can not be retrieved, {@code null} is returned.
93 * The own identity to get the trust for
94 * @return The trust assigned to this identity, or {@code null} if the trust
95 * could not be retrieved
97 public Trust getTrust(OwnIdentity ownIdentity);