Contacts events
Created 2 events used for the contact list (add/remove) of the client and requesting a list of users form the server.
This commit is contained in:
parent
3069b8cf50
commit
9dbaedbc8d
50
src/main/java/envoy/event/ContactOperation.java
Normal file
50
src/main/java/envoy/event/ContactOperation.java
Normal file
@ -0,0 +1,50 @@
|
||||
package envoy.event;
|
||||
|
||||
import envoy.data.User;
|
||||
|
||||
/**
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>ContactOperation.java</strong><br>
|
||||
* Created: <strong>05.02.2020</strong><br>
|
||||
*
|
||||
* @author Maximilian Käfer
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public class ContactOperation implements Event<User> {
|
||||
|
||||
public enum Operation {
|
||||
ADD, REMOVE;
|
||||
}
|
||||
|
||||
private final User contact;
|
||||
private final Operation operationType;
|
||||
|
||||
private static final long serialVersionUID = -1166652868189511553L;
|
||||
|
||||
/**
|
||||
* Initializes a {@link ContacsOperation}.
|
||||
*
|
||||
* @param operationType the {@link Operation} which should be executed on the
|
||||
* {@link contact}.
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public ContactOperation(User contact, Operation operationType) {
|
||||
this.contact = contact;
|
||||
this.operationType = operationType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the {@link User}, which should be added/removed from the contacts
|
||||
* list.
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
@Override
|
||||
public User get() { return contact; }
|
||||
|
||||
/**
|
||||
* @return the {@link Operation}, which should be executed with the contact,
|
||||
* this event corresponds with.
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public Operation getOperationType() { return operationType; }
|
||||
}
|
32
src/main/java/envoy/event/ContactsRequest.java
Normal file
32
src/main/java/envoy/event/ContactsRequest.java
Normal file
@ -0,0 +1,32 @@
|
||||
package envoy.event;
|
||||
|
||||
/**
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>ContactsRequest.java</strong><br>
|
||||
* Created: <strong>05.02.2020</strong><br>
|
||||
*
|
||||
* @author Maximilian Käfer
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public class ContactsRequest implements Event<String> {
|
||||
|
||||
private final String request;
|
||||
|
||||
private static final long serialVersionUID = -7969312055630533627L;
|
||||
|
||||
/**
|
||||
* Initializes a {@link ContactsRequest}.
|
||||
*
|
||||
* @param request the string, which is entered by the client to request
|
||||
* corresponding clients as contacts from the server.
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public ContactsRequest(String request) { this.request = request; }
|
||||
|
||||
/**
|
||||
* @return the request string
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
@Override
|
||||
public String get() { return request; }
|
||||
}
|
Reference in New Issue
Block a user