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 public class IdOnlySone implements Sone {
29 private final String id;
31 public IdOnlySone(String id) {
36 public Identity getIdentity() {
41 public String getName() {
46 public boolean isLocal() {
51 public FreenetURI getRequestUri() {
56 public FreenetURI getInsertUri() {
61 public long getLatestEdition() {
66 public void setLatestEdition(long latestEdition) {
70 public long getTime() {
75 public Sone setTime(long time) {
80 public SoneStatus getStatus() {
85 public Sone setStatus(SoneStatus status) {
90 public Profile getProfile() {
91 return new Profile(this);
95 public void setProfile(Profile profile) {
99 public Client getClient() {
104 public Sone setClient(Client client) {
109 public boolean isKnown() {
114 public Sone setKnown(boolean known) {
119 public List<String> getFriends() {
124 public boolean hasFriend(String friendSoneId) {
129 public List<Post> getPosts() {
134 public Sone setPosts(Collection<Post> posts) {
139 public void addPost(Post post) {
143 public void removePost(Post post) {
147 public Set<PostReply> getReplies() {
152 public Sone setReplies(Collection<PostReply> replies) {
157 public void addReply(PostReply reply) {
161 public void removeReply(PostReply reply) {
165 public Set<String> getLikedPostIds() {
170 public Sone setLikePostIds(Set<String> likedPostIds) {
175 public boolean isLikedPostId(String postId) {
180 public Sone addLikedPostId(String postId) {
185 public void removeLikedPostId(String postId) {
189 public Set<String> getLikedReplyIds() {
194 public Sone setLikeReplyIds(Set<String> likedReplyIds) {
199 public boolean isLikedReplyId(String replyId) {
204 public Sone addLikedReplyId(String replyId) {
209 public void removeLikedReplyId(String replyId) {
213 public Album getRootAlbum() {
218 public SoneOptions getOptions() {
223 public void setOptions(SoneOptions options) {
227 public int compareTo(Sone o) {
232 public String getFingerprint() {
237 public String getId() {
242 public int hashCode() {
243 return id.hashCode();
247 public boolean equals(Object object) {
248 return (object != null) && (object.getClass() == getClass()) && Objects.equal(id, ((IdOnlySone) object).id);