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 long getLatestEdition() {
61 public void setLatestEdition(long latestEdition) {
65 public long getTime() {
70 public Sone setTime(long time) {
75 public SoneStatus getStatus() {
80 public Sone setStatus(SoneStatus status) {
85 public Profile getProfile() {
86 return new Profile(this);
90 public void setProfile(Profile profile) {
94 public Client getClient() {
99 public Sone setClient(Client client) {
104 public boolean isKnown() {
109 public Sone setKnown(boolean known) {
114 public List<String> getFriends() {
119 public boolean hasFriend(String friendSoneId) {
124 public List<Post> getPosts() {
129 public Sone setPosts(Collection<Post> posts) {
134 public void addPost(Post post) {
138 public void removePost(Post post) {
142 public Set<PostReply> getReplies() {
147 public Sone setReplies(Collection<PostReply> replies) {
152 public void addReply(PostReply reply) {
156 public void removeReply(PostReply reply) {
160 public Set<String> getLikedPostIds() {
165 public Sone setLikePostIds(Set<String> likedPostIds) {
170 public boolean isLikedPostId(String postId) {
175 public Sone addLikedPostId(String postId) {
180 public void removeLikedPostId(String postId) {
184 public Set<String> getLikedReplyIds() {
189 public Sone setLikeReplyIds(Set<String> likedReplyIds) {
194 public boolean isLikedReplyId(String replyId) {
199 public Sone addLikedReplyId(String replyId) {
204 public void removeLikedReplyId(String replyId) {
208 public Album getRootAlbum() {
213 public SoneOptions getOptions() {
218 public void setOptions(SoneOptions options) {
222 public int compareTo(Sone o) {
227 public String getFingerprint() {
232 public String getId() {
237 public int hashCode() {
238 return id.hashCode();
242 public boolean equals(Object object) {
243 return (object != null) && (object.getClass() == getClass()) && Objects.equal(id, ((IdOnlySone) object).id);