package envoy.event;
import envoy.data.User;
import envoy.data.User.UserStatus;
/**
* Project: <strong>envoy-common</strong><br>
* File: <strong>UserStatusChangeEvent.java</strong><br>
* Created: <strong>1 Feb 2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Common v0.2-alpha
*/
public class UserStatusChangeEvent implements Event<UserStatus> {
private final long id;
private final User.UserStatus status;
private static final long serialVersionUID = 4566145392192761313L;
* Initializes a {@link UserStatusChangeEvent}.
* @param id the ID of the {@link User} this event is related to
* @param status the status of the {@link User} this event is related
* to
public UserStatusChangeEvent(long id, User.UserStatus status) {
this.id = id;
this.status = status;
}
* Initializes a {@link UserStatusChangeEvent} through a User.
* @param user the User from which to build the event
public UserStatusChangeEvent(User user) { this(user.getId(), user.getStatus()); }
* @return the status of the {@link User} this event is related to
@Override
public User.UserStatus get() { return status; }
* @return the ID of the {@link User} this event is related to
public long getId() { return id; }
public String toString() { return String.format("UserStatusChangeEvent[id=%d,status=%s]", id, status); }