projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove possibility to create Sones from sone provider interface.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
data
/
impl
/
PostImpl.java
diff --git
a/src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java
b/src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java
index
43d7d79
..
d422cba
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java
+++ b/
src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java
@@
-19,6
+19,7
@@
package net.pterodactylus.sone.data.impl;
import java.util.UUID;
import java.util.UUID;
+import net.pterodactylus.sone.core.SoneProvider;
import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Sone;
@@
-30,14
+31,17
@@
import net.pterodactylus.sone.data.Sone;
*/
public class PostImpl implements Post {
*/
public class PostImpl implements Post {
+ /** The Sone provider. */
+ private final SoneProvider soneProvider;
+
/** The GUID of the post. */
private final UUID id;
/** The GUID of the post. */
private final UUID id;
- /** The
Sone this post belongs to
. */
- private final S
one sone
;
+ /** The
ID of the owning Sone
. */
+ private final S
tring soneId
;
- /** The
Sone of the recipient
. */
- private final S
one recipient
;
+ /** The
ID of the recipient Sone
. */
+ private final S
tring recipientId
;
/** The time of the post (in milliseconds since Jan 1, 1970 UTC). */
private final long time;
/** The time of the post (in milliseconds since Jan 1, 1970 UTC). */
private final long time;
@@
-51,21
+55,24
@@
public class PostImpl implements Post {
/**
* Creates a new post.
*
/**
* Creates a new post.
*
+ * @param soneProvider
+ * The Sone provider
* @param id
* The ID of the post
* @param id
* The ID of the post
- * @param sone
- * The Sone this post belongs to
- * @param recipient
- * The recipient of the post
+ * @param sone
Id
+ * The
ID of the
Sone this post belongs to
+ * @param recipient
Id
+ * The
ID of the
recipient of the post
* @param time
* The time of the post (in milliseconds since Jan 1, 1970 UTC)
* @param text
* The text of the post
*/
* @param time
* The time of the post (in milliseconds since Jan 1, 1970 UTC)
* @param text
* The text of the post
*/
- public PostImpl(String id, Sone sone, Sone recipient, long time, String text) {
+ public PostImpl(SoneProvider soneProvider, String id, String soneId, String recipientId, long time, String text) {
+ this.soneProvider = soneProvider;
this.id = UUID.fromString(id);
this.id = UUID.fromString(id);
- this.sone
= sone
;
- this.recipient
= recipient
;
+ this.sone
Id = soneId
;
+ this.recipient
Id = recipientId
;
this.time = time;
this.text = text;
}
this.time = time;
this.text = text;
}
@@
-87,7
+94,7
@@
public class PostImpl implements Post {
*/
@Override
public Sone getSone() {
*/
@Override
public Sone getSone() {
- return sone;
+ return sone
Provider.getSone(soneId)
;
}
/**
}
/**
@@
-95,7
+102,7
@@
public class PostImpl implements Post {
*/
@Override
public Sone getRecipient() {
*/
@Override
public Sone getRecipient() {
- return
recipient
;
+ return
soneProvider.getSone(recipientId)
;
}
/**
}
/**
@@
-160,7
+167,7
@@
public class PostImpl implements Post {
*/
@Override
public String toString() {
*/
@Override
public String toString() {
- return
getClass().getName() + "[id=" + id + ",sone=" + sone + ",time=" + time + ",text=" + text + "]"
;
+ return
String.format("%s[id=%s,sone=%s,recipient=%s,time=%d,text=%s]", getClass().getName(), id, soneId, recipientId, time, text)
;
}
}
}
}