Package org.springframework.context
Class ApplicationEvent
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AbstractSubProtocolEvent
,ApplicationContextEvent
,BrokerAvailabilityEvent
,PayloadApplicationEvent
,RequestHandledEvent
,TestContextEvent
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, Juergen Hoeller
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionApplicationEvent
(Object source) ApplicationEvent
(Object source, Clock clock) Create a newApplicationEvent
with itstimestamp
set to the value returned byClock.millis()
in the providedClock
. -
Method Summary
Modifier and TypeMethodDescriptionfinal long
Return the time in milliseconds when the event occurred.Methods inherited from class java.util.EventObject
getSource, toString
-
Constructor Details
-
ApplicationEvent
- Parameters:
source
- the object on which the event initially occurred or with which the event is associated (nevernull
)- See Also:
-
ApplicationEvent
Create a newApplicationEvent
with itstimestamp
set to the value returned byClock.millis()
in the providedClock
.This constructor is typically used in testing scenarios.
- Parameters:
source
- the object on which the event initially occurred or with which the event is associated (nevernull
)clock
- a clock which will provide the timestamp- Since:
- 5.3.8
- See Also:
-
-
Method Details
-
getTimestamp
public final long getTimestamp()Return the time in milliseconds when the event occurred.
-