public class Post extends Descriptor
You cannot create a Post directly, as they cannot be modified. To post something, first create a Draft
then use its Draft.publish() method to convert it to a Post.
| Constructor and Description |
|---|
Post(long ID,
String areaID)
Creates an empty Post object pointing to a Post on the server-side.
|
| Modifier and Type | Method and Description |
|---|---|
net.wildfyre.areas.Area |
area()
The area in which is post was published.
|
Optional<User> |
author()
The author of this post.
|
CacheManager |
cacheManager()
The Cache Manager that handles this object.
|
Stream<Comment> |
comments()
The comments on this post.
|
List<Comment> |
commentsList()
The comments on this post, as a List.
|
ZonedDateTime |
created()
The date and time at which this post was created, in the UTC timezone.
|
ZonedDateTime |
createdLocalTime()
The date and time at which this post was created, in the local timezone.
|
boolean |
equals(Object o) |
static CacheManager |
getCacheManager()
The cache manager used by Posts.
|
int |
hashCode() |
boolean |
hasSubscribed()
Is the logged-in user subscribed to this post?
|
long |
ID()
The ID of this post.
|
boolean |
isActive()
Is this post active?
|
boolean |
isAnonymous()
Is this post anonymous?
|
boolean |
isAuthorDeleted()
Was the author of this post deleted?
|
String |
text()
The text of this post, in MarkDown.
|
protected com.eclipsesource.json.JsonObject |
toJsonSimple()
Generates the JSON String needed by the server to understand this object.
|
String |
toString() |
void |
update()
Updates this Descriptor.
|
isNew, isValid, isValid, usepublic Post(long ID,
String areaID)
Note that this method is provided for advanced users. If you want to create a new Post, you should first
create a Draft, edit it, then convert it to a Post. More information can be found here.
ID - the ID of the postareaID - the ID of the area the post is inpublic CacheManager cacheManager()
DescriptorcacheManager in class Descriptorpublic static CacheManager getCacheManager()
public void update()
throws NoSuchEntityException,
net.wildfyre.http.Request.CantConnectException
DescriptorThe update is always executed in the current thread.
update in class DescriptorNoSuchEntityExceptionnet.wildfyre.http.Request.CantConnectExceptionpublic boolean isAnonymous()
Note that in the case where a not-anonymous post's author is deleted, the post is still not anonymous, but doesn't have an author either.
true if the post is anonymous.Get the author of this message.,
Was the author of this post deleted?public boolean hasSubscribed()
true if the logged-in user subscribed to this post.public boolean isAuthorDeleted()
This method is a simple helper rather than a getter for some server-provided data. It is a shortcut for:
!author().isPresent() && !isAnonymous();
true if the author of this post was deleted.Is this post anonymous?,
The author of this post.public ZonedDateTime created()
In the local timezonepublic ZonedDateTime createdLocalTime()
ZoneId.systemDefault(), if you are searching for an other timezone,
use created() and ZonedDateTime.withZoneSameInstant(ZoneId).In the UTC timezonepublic boolean isActive()
An active post is a post that continues to spread to new users.
true if this post is active.public String text()
public Optional<User> author()
There are two cases where there may not be an author: the author chose this post post to be anonymous, or the original author was deleted since this post's creation.
Is this post anonymous?,
Was the author of this post deleted?public net.wildfyre.areas.Area area()
public long ID()
This API is crafted so that the end-user doesn't need to use IDs. This method is provided for the rare case where you need the ID for customized handling of the cache.
public List<Comment> commentsList()
The returned list is read-only and provided by Collections.unmodifiableList(List).
We recommend using Streamspublic Stream<Comment> comments()
Get the comments in a List.protected final com.eclipsesource.json.JsonObject toJsonSimple()