Merge branch 'release-0.9.6'
[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 Sone removeLikedPostId(String postId) {
188                 return this;
189         }
190
191         @Override
192         public Set<String> getLikedReplyIds() {
193                 return emptySet();
194         }
195
196         @Override
197         public Sone setLikeReplyIds(Set<String> likedReplyIds) {
198                 return this;
199         }
200
201         @Override
202         public boolean isLikedReplyId(String replyId) {
203                 return false;
204         }
205
206         @Override
207         public Sone addLikedReplyId(String replyId) {
208                 return this;
209         }
210
211         @Override
212         public Sone removeLikedReplyId(String replyId) {
213                 return this;
214         }
215
216         @Override
217         public Album getRootAlbum() {
218                 return null;
219         }
220
221         @Override
222         public SoneOptions getOptions() {
223                 return null;
224         }
225
226         @Override
227         public void setOptions(SoneOptions options) {
228         }
229
230         @Override
231         public int compareTo(Sone o) {
232                 return 0;
233         }
234
235         @Override
236         public String getFingerprint() {
237                 return null;
238         }
239
240         @Override
241         public String getId() {
242                 return id;
243         }
244
245         @Override
246         public int hashCode() {
247                 return id.hashCode();
248         }
249
250         @Override
251         public boolean equals(Object object) {
252                 return (object != null) && (object.getClass() == getClass()) && Objects.equal(id, ((IdOnlySone) object).id);
253         }
254
255 }