Return a nullable Image instead of an Optional
[Sone.git] / src / main / java / net / pterodactylus / sone / data / impl / IdOnlySone.java
1 package net.pterodactylus.sone.data.impl;
2
3 import static java.util.Collections.emptyList;
4 import static java.util.Collections.emptySet;
5
6 import java.util.Collection;
7 import java.util.List;
8 import java.util.Set;
9
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;
18
19 import freenet.keys.FreenetURI;
20
21 import com.google.common.base.Objects;
22
23 /**
24  * {@link Sone} implementation that only stores the ID of a Sone and returns
25  * {@code null}, {@code 0}, or empty collections where appropriate.
26  *
27  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
28  */
29 public class IdOnlySone implements Sone {
30
31         private final String id;
32
33         public IdOnlySone(String id) {
34                 this.id = id;
35         }
36
37         @Override
38         public Identity getIdentity() {
39                 return null;
40         }
41
42         @Override
43         public String getName() {
44                 return id;
45         }
46
47         @Override
48         public boolean isLocal() {
49                 return false;
50         }
51
52         @Override
53         public FreenetURI getRequestUri() {
54                 return null;
55         }
56
57         @Override
58         public FreenetURI getInsertUri() {
59                 return null;
60         }
61
62         @Override
63         public long getLatestEdition() {
64                 return 0;
65         }
66
67         @Override
68         public void setLatestEdition(long latestEdition) {
69         }
70
71         @Override
72         public long getTime() {
73                 return 0;
74         }
75
76         @Override
77         public Sone setTime(long time) {
78                 return null;
79         }
80
81         @Override
82         public SoneStatus getStatus() {
83                 return null;
84         }
85
86         @Override
87         public Sone setStatus(SoneStatus status) {
88                 return null;
89         }
90
91         @Override
92         public Profile getProfile() {
93                 return new Profile(this);
94         }
95
96         @Override
97         public void setProfile(Profile profile) {
98         }
99
100         @Override
101         public Client getClient() {
102                 return null;
103         }
104
105         @Override
106         public Sone setClient(Client client) {
107                 return null;
108         }
109
110         @Override
111         public boolean isKnown() {
112                 return false;
113         }
114
115         @Override
116         public Sone setKnown(boolean known) {
117                 return null;
118         }
119
120         @Override
121         public List<String> getFriends() {
122                 return emptyList();
123         }
124
125         @Override
126         public boolean hasFriend(String friendSoneId) {
127                 return false;
128         }
129
130         @Override
131         public List<Post> getPosts() {
132                 return emptyList();
133         }
134
135         @Override
136         public Sone setPosts(Collection<Post> posts) {
137                 return this;
138         }
139
140         @Override
141         public void addPost(Post post) {
142         }
143
144         @Override
145         public void removePost(Post post) {
146         }
147
148         @Override
149         public Set<PostReply> getReplies() {
150                 return emptySet();
151         }
152
153         @Override
154         public Sone setReplies(Collection<PostReply> replies) {
155                 return this;
156         }
157
158         @Override
159         public void addReply(PostReply reply) {
160         }
161
162         @Override
163         public void removeReply(PostReply reply) {
164         }
165
166         @Override
167         public Set<String> getLikedPostIds() {
168                 return emptySet();
169         }
170
171         @Override
172         public Sone setLikePostIds(Set<String> likedPostIds) {
173                 return this;
174         }
175
176         @Override
177         public boolean isLikedPostId(String postId) {
178                 return false;
179         }
180
181         @Override
182         public Sone addLikedPostId(String postId) {
183                 return this;
184         }
185
186         @Override
187         public void removeLikedPostId(String postId) {
188         }
189
190         @Override
191         public Set<String> getLikedReplyIds() {
192                 return emptySet();
193         }
194
195         @Override
196         public Sone setLikeReplyIds(Set<String> likedReplyIds) {
197                 return this;
198         }
199
200         @Override
201         public boolean isLikedReplyId(String replyId) {
202                 return false;
203         }
204
205         @Override
206         public Sone addLikedReplyId(String replyId) {
207                 return this;
208         }
209
210         @Override
211         public void removeLikedReplyId(String replyId) {
212         }
213
214         @Override
215         public Album getRootAlbum() {
216                 return null;
217         }
218
219         @Override
220         public SoneOptions getOptions() {
221                 return null;
222         }
223
224         @Override
225         public void setOptions(SoneOptions options) {
226         }
227
228         @Override
229         public int compareTo(Sone o) {
230                 return 0;
231         }
232
233         @Override
234         public String getFingerprint() {
235                 return null;
236         }
237
238         @Override
239         public String getId() {
240                 return id;
241         }
242
243         @Override
244         public int hashCode() {
245                 return id.hashCode();
246         }
247
248         @Override
249         public boolean equals(Object object) {
250                 return (object != null) && (object.getClass() == getClass()) && Objects.equal(id, ((IdOnlySone) object).id);
251         }
252
253 }