* {@code true} to include replies, {@code false} to not include
* replies
* @return The simple field set containing the post
*/
protected SimpleFieldSet encodePost(Post post, String prefix, boolean includeReplies) {
SimpleFieldSetBuilder postBuilder = new SimpleFieldSetBuilder();
postBuilder.put(prefix + "ID", post.getId());
postBuilder.put(prefix + "Sone", post.getSone().getId());
if (post.getRecipientId().isPresent()) {
postBuilder.put(prefix + "Recipient", post.getRecipientId().get());
}
postBuilder.put(prefix + "Time", post.getTime());
postBuilder.put(prefix + "Text", encodeString(post.getText()));
postBuilder.put(encodeLikes(core.getLikes(post), prefix + "Likes."));
if (includeReplies) {
List<PostReply> replies = core.getReplies(post.getId());
postBuilder.put(encodeReplies(replies, prefix));
}
return postBuilder.get();
}