// Copyright 2020 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.entitySystem.event;

/**
 * Immutable event to notify a change in a certain value.
 * NOTE: This is a generic event and a more specific Event extending this event should be fired and reacted to.
 */
public abstract class BeforeAfterEvent<T> implements Event {
    protected final T oldValue;
    protected final T newValue;

    /**
     * Creates a new notification event on change in value.
     */
    BeforeAfterEvent(final T oldValue, final T newValue) {
        this.oldValue = oldValue;
        this.newValue = newValue;
    }

    /**
     * Returns the value prior to change.
     */
    public T getOldValue() {
        return oldValue;
    }

    /**
     * Returns the value after change.
     */
    public T getNewValue() {
        return newValue;
    }
}

@@ -190,13 +190,347 @@
 %0A * 
-NOTE:
+%3Cp%3E%0A * Send this event to notify interested systems about a change in a value. It is good practice to only sent this event%0A * if the %7B@code newValue%7D is different from the %7B@code oldValue%7D. The event should notify about a change that has%0A * already happened. The event can neither be consumed nor modified.%0A * %3Cp%3E%0A * %3Cstrong%3ENote:%3C/strong%3E
  Thi
@@ -616,16 +616,19 @@
 ired and
+%0A *
  reacted
@@ -836,21 +836,184 @@
 .%0A     *
-/
 %0A   
+  * @param oldValue the value prior to the change, may be %7B@code null%7D%0A     * @param newValue the value after the the change, may be %7B@code null%7D%0A     */%0A    public
  BeforeA
@@ -1177,32 +1177,101 @@
 rior to change.%0A
+     *%0A     * @return the value prior to change, may be %7B@code null%7D%0A
      */%0A    publ
@@ -1366,24 +1366,94 @@
 ter change.%0A
+     *%0A     * @return the value after the change, may be %7B@code null%7D%0A
      */%0A    

Improve docs for BeforeAfterEvent