X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftemplate%2FAlbumAccessor.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftemplate%2FAlbumAccessor.java;h=e2c6f16d78bd7c7e060f2a3b88a77a4173ecb121;hb=89afd4d07bb120cbabd91d07493f4e5f2f74d816;hp=0000000000000000000000000000000000000000;hpb=b58cd0a450858a1eb9986af0f60bbbe1d5ddcdc6;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/template/AlbumAccessor.java b/src/main/java/net/pterodactylus/sone/template/AlbumAccessor.java
new file mode 100644
index 0000000..e2c6f16
--- /dev/null
+++ b/src/main/java/net/pterodactylus/sone/template/AlbumAccessor.java
@@ -0,0 +1,78 @@
+/*
+ * Sone - AlbumAccessor.java - Copyright © 2011 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package net.pterodactylus.sone.template;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import net.pterodactylus.sone.data.Album;
+import net.pterodactylus.util.template.Accessor;
+import net.pterodactylus.util.template.DataProvider;
+import net.pterodactylus.util.template.ReflectionAccessor;
+
+/**
+ * {@link Accessor} implementation for {@link Album}s. A property named
+ * âbacklinksâ is added, it returns links to all parents and the owner Sone of
+ * an album.
+ *
+ * @author David âBombeâ Roden
+ */
+public class AlbumAccessor extends ReflectionAccessor {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object get(DataProvider dataProvider, Object object, String member) {
+ Album album = (Album) object;
+ if ("backlinks".equals(member)) {
+ List