All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.dreamlu.event.core.ApplicationEvent Maven / Gradle / Ivy

package net.dreamlu.event.core;

import java.util.EventObject;

/**
 * Class to be extended by all application events. Abstract as it
 * doesn't make sense for generic events to be published directly.
 *
 * @author Rod Johnson
 * @author Juergen Hoeller
 */
public abstract class ApplicationEvent extends EventObject {

	/** use serialVersionUID from Spring 1.2 for interoperability */
	private static final long serialVersionUID = 7099057708183571937L;

	/** System time when the event happened */
	private final long timestamp;


	/**
	 * Create a new ApplicationEvent.
	 * @param source the component that published the event (never {@code null})
	 */
	public ApplicationEvent(Object source) {
		super(source);
		this.timestamp = System.currentTimeMillis();
	}

	/**
	 * Return the system time in milliseconds when the event happened.
	 * @return Return the system time in milliseconds
	 */
	public final long getTimestamp() {
		return this.timestamp;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy