1 package net.pterodactylus.sone.data.impl;
3 import static java.util.Collections.emptyList;
4 import static java.util.Collections.emptySet;
6 import java.util.Collection;
10 import net.pterodactylus.sone.data.Album;
11 import net.pterodactylus.sone.data.Client;
12 import net.pterodactylus.sone.data.Post;
13 import net.pterodactylus.sone.data.PostReply;
14 import net.pterodactylus.sone.data.Profile;
15 import net.pterodactylus.sone.data.Sone;
16 import net.pterodactylus.sone.data.SoneOptions;
17 import net.pterodactylus.sone.freenet.wot.Identity;
19 import freenet.keys.FreenetURI;
21 import com.google.common.base.Objects;
24 * {@link Sone} implementation that only stores the ID of a Sone and returns
25 * {@code null}, {@code 0}, or empty collections where appropriate.
27 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
29 public class IdOnlySone implements Sone {
31 private final String id;
33 public IdOnlySone(String id) {
38 public Identity getIdentity() {
43 public String getName() {
48 public boolean isLocal() {
53 public FreenetURI getRequestUri() {
58 public FreenetURI getInsertUri() {
63 public long getLatestEdition() {
68 public void setLatestEdition(long latestEdition) {
72 public long getTime() {
77 public Sone setTime(long time) {
82 public SoneStatus getStatus() {
87 public Sone setStatus(SoneStatus status) {
92 public Profile getProfile() {
93 return new Profile(this);
97 public void setProfile(Profile profile) {
101 public Client getClient() {
106 public Sone setClient(Client client) {
111 public boolean isKnown() {
116 public Sone setKnown(boolean known) {
121 public List<String> getFriends() {
126 public boolean hasFriend(String friendSoneId) {
131 public List<Post> getPosts() {
136 public Sone setPosts(Collection<Post> posts) {
141 public void addPost(Post post) {
145 public void removePost(Post post) {
149 public Set<PostReply> getReplies() {
154 public Sone setReplies(Collection<PostReply> replies) {
159 public void addReply(PostReply reply) {
163 public void removeReply(PostReply reply) {
167 public Set<String> getLikedPostIds() {
172 public Sone setLikePostIds(Set<String> likedPostIds) {
177 public boolean isLikedPostId(String postId) {
182 public Sone addLikedPostId(String postId) {
187 public Sone removeLikedPostId(String postId) {
192 public Set<String> getLikedReplyIds() {
197 public Sone setLikeReplyIds(Set<String> likedReplyIds) {
202 public boolean isLikedReplyId(String replyId) {
207 public Sone addLikedReplyId(String replyId) {
212 public Sone removeLikedReplyId(String replyId) {
217 public Album getRootAlbum() {
222 public SoneOptions getOptions() {
227 public void setOptions(SoneOptions options) {
231 public int compareTo(Sone o) {
236 public String getFingerprint() {
241 public String getId() {
246 public int hashCode() {
247 return id.hashCode();
251 public boolean equals(Object object) {
252 return (object != null) && (object.getClass() == getClass()) && Objects.equal(id, ((IdOnlySone) object).id);