X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=inline;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftemplate%2FIdentityAccessor.java;h=7766af30979725207bfffe089c7f4faa1cc41b9d;hb=972ca0e1490124c9da45a12ee9a079d91d62d6dc;hp=c08a0a223226cd73898536f0221e67590eda1f30;hpb=6e9a43ccd93ae125720547c0fe421dc81a54ba90;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/template/IdentityAccessor.java b/src/main/java/net/pterodactylus/sone/template/IdentityAccessor.java
index c08a0a2..7766af3 100644
--- a/src/main/java/net/pterodactylus/sone/template/IdentityAccessor.java
+++ b/src/main/java/net/pterodactylus/sone/template/IdentityAccessor.java
@@ -1,5 +1,5 @@
/*
- * Sone - IdentityAccessor.java - Copyright © 2010â2013 David Roden
+ * Sone - IdentityAccessor.java - Copyright © 2010â2016 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,6 +19,9 @@ package net.pterodactylus.sone.template;
import java.util.Set;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.freenet.wot.Identity;
import net.pterodactylus.sone.freenet.wot.OwnIdentity;
@@ -32,6 +35,7 @@ import net.pterodactylus.util.template.TemplateContext;
*
* @author David âBombeâ Roden
*/
+@Singleton
public class IdentityAccessor extends ReflectionAccessor {
/** The core. */
@@ -43,6 +47,7 @@ public class IdentityAccessor extends ReflectionAccessor {
* @param core
* The core
*/
+ @Inject
public IdentityAccessor(Core core) {
this.core = core;
}
@@ -55,9 +60,8 @@ public class IdentityAccessor extends ReflectionAccessor {
Identity identity = (Identity) object;
if ("uniqueNickname".equals(member)) {
int minLength = -1;
- boolean found = false;
- Set ownIdentities = null;
- ownIdentities = core.getIdentityManager().getAllOwnIdentities();
+ boolean found;
+ Set ownIdentities = core.getIdentityManager().getAllOwnIdentities();
do {
boolean unique = true;
String abbreviatedWantedNickname = getAbbreviatedNickname(identity, ++minLength);