Added UserStatusChange - Event

This commit is contained in:
delvh 2020-02-01 11:32:55 +01:00
parent 513a1c38aa
commit 8afafa014b
2 changed files with 57 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,54 @@
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
* @since Envoy Common v0.2-alpha
*/
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
* @since Envoy Common v0.2-alpha
*/
public UserStatusChangeEvent(User user) { this(user.getId(), user.getStatus()); }
/**
* @return the status of the {@link User} this event is related to
* @since Envoy Common v0.2-alpha
*/
@Override
public User.UserStatus get() { return status; }
/**
* @return the ID of the {@link User} this event is related to
* @since Envoy Common v0.2-alpha
*/
public long getId() { return id; }
}