projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Extract an interface out of Sone.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
template
/
SoneAccessor.java
diff --git
a/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java
b/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java
index
eca8654
..
92be8e0
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/template/SoneAccessor.java
+++ b/
src/main/java/net/pterodactylus/sone/template/SoneAccessor.java
@@
-1,5
+1,5
@@
/*
/*
- * Sone - SoneAccessor.java - Copyright © 2010–201
2
David Roden
+ * Sone - SoneAccessor.java - Copyright © 2010–201
3
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
*
* 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
@@
-17,6
+17,11
@@
package net.pterodactylus.sone.template;
package net.pterodactylus.sone.template;
+import static com.google.common.collect.FluentIterable.from;
+import static java.util.Arrays.asList;
+import static net.pterodactylus.sone.data.Album.FLATTENER;
+import static net.pterodactylus.sone.data.Album.IMAGES;
+
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.Level;
import java.util.logging.Logger;
@@
-76,8
+81,6
@@
public class SoneAccessor extends ReflectionAccessor {
Sone sone = (Sone) object;
if (member.equals("niceName")) {
return getNiceName(sone);
Sone sone = (Sone) object;
if (member.equals("niceName")) {
return getNiceName(sone);
- } else if (member.equals("local")) {
- return core.isLocalSone(sone);
} else if (member.equals("friend")) {
Sone currentSone = (Sone) templateContext.get("currentSone");
return (currentSone != null) && currentSone.hasFriend(sone.getId());
} else if (member.equals("friend")) {
Sone currentSone = (Sone) templateContext.get("currentSone");
return (currentSone != null) && currentSone.hasFriend(sone.getId());
@@
-113,6
+116,10
@@
public class SoneAccessor extends ReflectionAccessor {
return new Trust(null, null, null);
}
return trust;
return new Trust(null, null, null);
}
return trust;
+ } else if (member.equals("allImages")) {
+ return from(asList(sone.getRootAlbum())).transformAndConcat(FLATTENER).transformAndConcat(IMAGES);
+ } else if (member.equals("albums")) {
+ return sone.getRootAlbum().getAlbums();
}
return super.get(templateContext, object, member);
}
}
return super.get(templateContext, object, member);
}