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

top.jfunc.common.event.core.ApplicationEvent Maven / Gradle / Ivy

There is a newer version: 1.8.5
Show newest version
package top.jfunc.common.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 - 2024 Weber Informatics LLC | Privacy Policy