public abstract class Event extends Object
An event represents an action that was triggered by a user or a system action. Actions made by user typically corresponds to posting messages, editing messages, etc. and actions made by the system typically corresponds to feeds added, change in access level, etc.
All events have a instant at which they occured, represented by an Instant
object (UTC). They also have the user that
triggered the action (ID and display name), with the exception of anonymous events (like starring).
For system events, the ID will be strictly negative and for anonymous events, it is will be 0.
Modifier and Type | Method and Description |
---|---|
Instant |
getInstant()
Returns the instant in time (UTC) at which this event occured.
|
Room |
getRoom()
The room this event took place.
|
int |
getRoomId()
Returns the ID of the room this event took place.
|
Optional<User> |
getUser()
Returns the user that raised this event, at the time the event was raised.
|
long |
getUserId()
Returns the id of the user that raised this event.
|
String |
getUserName()
Returns the display name of the user that raised this event.
|
public Instant getInstant()
public Optional<User> getUser()
The returned user will not be updated with regards to, e.g, reputation changes that were made after this event.
If an updated user is needed, refer to Room.getUser(long)
.
For events where there was no registered user, or system generated event, this returns an empty Optional
.
public long getUserId()
For system generated event, the id will be strictly negative. For events where there was no registered user, this will be 0.
getUser()
public String getUserName()
null
under unreproducible conditions.public Room getRoom()
public int getRoomId()
Room.getRoomId()
getRoom()