X-Git-Url: https://git.pterodactylus.net/?p=WoTNS.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fwotns%2Fmain%2FIdentityTargets.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fwotns%2Fmain%2FIdentityTargets.java;h=a992091118916cabb031155f689d8b2cd87ffff7;hp=54dc660b33d90bb543d87dcc59cbe81831523076;hb=19cb82fef226e1d2aee9e761df4b4d3a9539718e;hpb=c8ce27add745df83ba513dc3fbf8908713bbc6b7
diff --git a/src/main/java/net/pterodactylus/wotns/main/IdentityTargets.java b/src/main/java/net/pterodactylus/wotns/main/IdentityTargets.java
index 54dc660..a992091 100644
--- a/src/main/java/net/pterodactylus/wotns/main/IdentityTargets.java
+++ b/src/main/java/net/pterodactylus/wotns/main/IdentityTargets.java
@@ -26,25 +26,49 @@ import java.util.Map.Entry;
import net.pterodactylus.wotns.freenet.wot.Identity;
/**
- * TODO
+ * Scans an {@link Identity}âs properties for WoTNS targets.
*
* @author David âBombeâ Roden
*/
public class IdentityTargets implements Iterable> {
+ /** The identity being scanned. */
private final Identity identity;
+ /** The located targets. */
private final Map targets = new HashMap();
+ /**
+ * Creates a new target scanner for the given identity.
+ *
+ * @param identity
+ * The identity to scan for targets
+ */
public IdentityTargets(Identity identity) {
this.identity = identity;
}
+ //
+ // ACCESSORS
+ //
+
+ /**
+ * Returns the targets of the identity.
+ *
+ * @return The targets defined in the identity
+ */
public Map getTargets() {
scanForTargets();
return Collections.unmodifiableMap(targets);
}
+ /**
+ * Returns the target with the given name.
+ *
+ * @param name
+ * The name of the target
+ * @return The target
+ */
public String getTarget(String name) {
scanForTargets();
return targets.get(name);
@@ -54,6 +78,9 @@ public class IdentityTargets implements Iterable> {
// PRIVATE METHODS
//
+ /**
+ * Re-scans the identity for targets.
+ */
private void scanForTargets() {
synchronized (targets) {
targets.clear();