package envoy.event; import java.io.Serializable; /** * Project: envoy-common
* File: Event.java
* Created: 04.12.2019
* * @author Kai S. K. Engelbart * @param the type of the Event * @since Envoy v0.2-alpha */ public abstract class Event implements Serializable { protected final T value; private static final long serialVersionUID = 4673659457380399167L; protected Event(T value) { this.value = value; } /** * @return the data associated with this event */ public T get() { return value; } @Override public String toString() { return String.format("%s[value=%s]", this.getClass().getSimpleName(), value); } /** * Serves as a super class for events that do not carry a value.
*
* Project: envoy-common
* File: Event.java
* Created: 11 Feb 2020
* * @author Kai S. K. Engelbart * @since Envoy Common v0.2-alpha */ public static abstract class Valueless extends Event { private static final long serialVersionUID = -9019362144094097997L; protected Valueless() { super(null); } @Override public String toString() { return this.getClass().getSimpleName(); } } }