From 5c19fe28492950c61068c8d129b293cb2e2d2b74 Mon Sep 17 00:00:00 2001 From: kske Date: Tue, 28 Jan 2020 18:58:44 +0100 Subject: [PATCH] Added HandshakeRejectionEvent and fixed some Javadoc --- .../envoy/event/HandshakeRejectionEvent.java | 41 +++++++++++++++++++ .../java/envoy/event/IdGeneratorRequest.java | 1 + .../envoy/event/MessageStatusChangeEvent.java | 2 +- 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/main/java/envoy/event/HandshakeRejectionEvent.java diff --git a/src/main/java/envoy/event/HandshakeRejectionEvent.java b/src/main/java/envoy/event/HandshakeRejectionEvent.java new file mode 100644 index 0000000..aca655e --- /dev/null +++ b/src/main/java/envoy/event/HandshakeRejectionEvent.java @@ -0,0 +1,41 @@ +package envoy.event; + +/** + * Signifies to the client that the handshake failed for the attached + * reason.
+ *
+ * Project: envoy-common
+ * File: HandshakeRejectionEvent.java
+ * Created: 28 Jan 2020
+ * + * @author Kai S. K. Engelbart + * @since Envoy Common v0.3-alpha + */ +public class HandshakeRejectionEvent implements Event { + + private final String reason; + + private static final long serialVersionUID = -8723270093452609197L; + + /** + * Creates an instance of {@link HandshakeRejectionEvent} with an empty reason. + * + * @since Envoy Common v0.3-alpha + */ + public HandshakeRejectionEvent() { this(""); } + + /** + * Creates an instance of {@link HandshakeRejectionEvent}. + * + * @param reason the reason why the handshake was rejected + * @since Envoy Common v0.3-alpha + */ + public HandshakeRejectionEvent(String reason) { this.reason = reason; } + + /** + * @return the reason why the handshake was rejected + * @since Envoy Common v0.3-alpha + */ + @Override + public String get() { return reason; } +} diff --git a/src/main/java/envoy/event/IdGeneratorRequest.java b/src/main/java/envoy/event/IdGeneratorRequest.java index ec3ae34..885f40d 100644 --- a/src/main/java/envoy/event/IdGeneratorRequest.java +++ b/src/main/java/envoy/event/IdGeneratorRequest.java @@ -9,6 +9,7 @@ package envoy.event; * Created: 28 Jan 2020
* * @author Kai S. K. Engelbart + * @since Envoy Common v0.3-alpha */ public class IdGeneratorRequest implements Event { diff --git a/src/main/java/envoy/event/MessageStatusChangeEvent.java b/src/main/java/envoy/event/MessageStatusChangeEvent.java index 88b6cad..c56f7a0 100644 --- a/src/main/java/envoy/event/MessageStatusChangeEvent.java +++ b/src/main/java/envoy/event/MessageStatusChangeEvent.java @@ -36,7 +36,7 @@ public class MessageStatusChangeEvent implements Event { } /** - * Initialises a {@link MessageStatusChangeEvent} through a message. + * Initializes a {@link MessageStatusChangeEvent} through a message. * * @param message the message from which to build the event * @since Envoy Common v0.2-alpha