2020-02-01 11:32:55 +01:00
|
|
|
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
|
|
|
|
*/
|
2020-02-11 16:53:41 +01:00
|
|
|
public class UserStatusChangeEvent extends Event<UserStatus> {
|
2020-02-01 11:32:55 +01:00
|
|
|
|
2020-02-11 16:53:41 +01:00
|
|
|
private final long id;
|
2020-02-01 11:32:55 +01:00
|
|
|
|
2020-03-24 19:06:56 +01:00
|
|
|
private static final long serialVersionUID = 0L;
|
2020-02-01 11:32:55 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
* @since Envoy Common v0.2-alpha
|
|
|
|
*/
|
|
|
|
public UserStatusChangeEvent(long id, User.UserStatus status) {
|
2020-02-11 16:53:41 +01:00
|
|
|
super(status);
|
|
|
|
this.id = id;
|
2020-02-01 11:32:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes a {@link UserStatusChangeEvent} through a User.
|
|
|
|
*
|
|
|
|
* @param user the User from which to build the event
|
|
|
|
* @since Envoy Common v0.2-alpha
|
|
|
|
*/
|
2020-03-25 16:33:06 +01:00
|
|
|
public UserStatusChangeEvent(User user) { this(user.getID(), user.getStatus()); }
|
2020-02-01 11:32:55 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the ID of the {@link User} this event is related to
|
|
|
|
* @since Envoy Common v0.2-alpha
|
|
|
|
*/
|
|
|
|
public long getId() { return id; }
|
2020-02-02 14:20:11 +01:00
|
|
|
|
|
|
|
@Override
|
2020-02-11 16:53:41 +01:00
|
|
|
public String toString() { return String.format("UserStatusChangeEvent[id=%d,status=%s]", id, value); }
|
2020-02-01 11:32:55 +01:00
|
|
|
}
|