From: David ‘Bombe’ Roden Date: Tue, 29 Jan 2013 05:43:37 +0000 (+0100) Subject: Move getSones() method to Sone provider interface. X-Git-Tag: 0.8.5^2~3^2~29 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=921177685a8622866750a3740f94786d88127d95 Move getSones() method to Sone provider interface. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 4d39c10..de6ba55 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -347,11 +347,10 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, } /** - * Returns all Sones, remote and local. - * - * @return All Sones + * {@inheritDocs} */ - public Set getSones() { + @Override + public Collection getSones() { synchronized (sones) { return Collections.unmodifiableCollection(sones.values()); } diff --git a/src/main/java/net/pterodactylus/sone/database/SoneProvider.java b/src/main/java/net/pterodactylus/sone/database/SoneProvider.java index bbe0abf..f484aaf 100644 --- a/src/main/java/net/pterodactylus/sone/database/SoneProvider.java +++ b/src/main/java/net/pterodactylus/sone/database/SoneProvider.java @@ -17,6 +17,8 @@ package net.pterodactylus.sone.database; +import java.util.Collection; + import net.pterodactylus.sone.data.Sone; import com.google.common.base.Optional; @@ -38,4 +40,11 @@ public interface SoneProvider { */ public Optional getSone(String soneId); + /** + * Returns all Sones. + * + * @return All Sones + */ + public Collection getSones(); + } diff --git a/src/main/java/net/pterodactylus/sone/web/SearchPage.java b/src/main/java/net/pterodactylus/sone/web/SearchPage.java index 320e7cd..01a5ed0 100644 --- a/src/main/java/net/pterodactylus/sone/web/SearchPage.java +++ b/src/main/java/net/pterodactylus/sone/web/SearchPage.java @@ -131,7 +131,7 @@ public class SearchPage extends SoneTemplatePage { redirectIfNotNull(getImageId(phrase), "imageBrowser.html?image="); } - Set sones = webInterface.getCore().getSones(); + Collection sones = webInterface.getCore().getSones(); Collection> soneHits = getHits(sones, phrases, SoneStringGenerator.COMPLETE_GENERATOR); Collection> postHits = hitCache.getUnchecked(phrases);