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.Image;
13 import net.pterodactylus.sone.data.Post;
14 import net.pterodactylus.sone.data.PostReply;
15 import net.pterodactylus.sone.data.Profile;
16 import net.pterodactylus.sone.data.Sone;
17 import net.pterodactylus.sone.data.SoneOptions;
18 import net.pterodactylus.sone.freenet.wot.Identity;
20 import com.google.common.base.Optional;
21 import freenet.keys.FreenetURI;
23 import com.google.common.base.Objects;
26 * {@link Sone} implementation that only stores the ID of a Sone and returns
27 * {@code null}, {@code 0}, or empty collections where appropriate.
29 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
31 public class IdOnlySone implements Sone {
33 private final String id;
35 public IdOnlySone(String id) {
40 public Identity getIdentity() {
45 public String getName() {
50 public boolean isLocal() {
55 public FreenetURI getRequestUri() {
60 public FreenetURI getInsertUri() {
65 public long getLatestEdition() {
70 public void setLatestEdition(long latestEdition) {
74 public long getTime() {
79 public Sone setTime(long time) {
84 public SoneStatus getStatus() {
89 public Sone setStatus(SoneStatus status) {
94 public Profile getProfile() {
95 return new Profile(this);
99 public void setProfile(Profile profile) {
103 public Client getClient() {
108 public Sone setClient(Client client) {
113 public boolean isKnown() {
118 public Sone setKnown(boolean known) {
123 public List<String> getFriends() {
128 public boolean hasFriend(String friendSoneId) {
133 public List<Post> getPosts() {
138 public Sone setPosts(Collection<Post> posts) {
143 public void addPost(Post post) {
147 public void removePost(Post post) {
151 public Set<PostReply> getReplies() {
156 public Sone setReplies(Collection<PostReply> replies) {
161 public void addReply(PostReply reply) {
165 public void removeReply(PostReply reply) {
169 public Set<String> getLikedPostIds() {
174 public Sone setLikePostIds(Set<String> likedPostIds) {
179 public boolean isLikedPostId(String postId) {
184 public Sone addLikedPostId(String postId) {
189 public Sone removeLikedPostId(String postId) {
194 public Set<String> getLikedReplyIds() {
199 public Sone setLikeReplyIds(Set<String> likedReplyIds) {
204 public boolean isLikedReplyId(String replyId) {
209 public Sone addLikedReplyId(String replyId) {
214 public Sone removeLikedReplyId(String replyId) {
219 public Album getRootAlbum() {
224 public Optional<Image> getImageByInternalId(String internalId) {
225 return Optional.absent();
229 public SoneOptions getOptions() {
234 public void setOptions(SoneOptions options) {
238 public int compareTo(Sone o) {
243 public String getFingerprint() {
248 public String getId() {
253 public int hashCode() {
254 return id.hashCode();
258 public boolean equals(Object object) {
259 return (object != null) && (object.getClass() == getClass()) && Objects.equal(id, ((IdOnlySone) object).id);