1
1
/*
2
- * Copyright 2002-2019 the original author or authors.
2
+ * Copyright 2002-2021 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -38,20 +38,26 @@ public abstract class ApplicationEvent extends EventObject {
38
38
39
39
40
40
/**
41
- * Create a new {@code ApplicationEvent}.
41
+ * Create a new {@code ApplicationEvent} with its {@link #getTimestamp() timestamp}
42
+ * set to {@link System#currentTimeMillis()}.
42
43
* @param source the object on which the event initially occurred or with
43
44
* which the event is associated (never {@code null})
45
+ * @see #ApplicationEvent(Object, Clock)
44
46
*/
45
47
public ApplicationEvent (Object source ) {
46
48
super (source );
47
49
this .timestamp = System .currentTimeMillis ();
48
50
}
49
51
50
52
/**
51
- * Create a new {@code ApplicationEvent} with a fixed timestamp.
53
+ * Create a new {@code ApplicationEvent} with its {@link #getTimestamp() timestamp}
54
+ * set to the value returned by {@link Clock#millis()} in the provided {@link Clock}.
55
+ * <p>This constructor is typically used in testing scenarios.
52
56
* @param source the object on which the event initially occurred or with
53
57
* which the event is associated (never {@code null})
54
58
* @param clock a clock which will provide the timestamp
59
+ * @since 5.3.8
60
+ * @see #ApplicationEvent(Object)
55
61
*/
56
62
public ApplicationEvent (Object source , Clock clock ) {
57
63
super (source );
@@ -60,7 +66,9 @@ public ApplicationEvent(Object source, Clock clock) {
60
66
61
67
62
68
/**
63
- * Return the system time in milliseconds when the event occurred.
69
+ * Return the time in milliseconds when the event occurred.
70
+ * @see #ApplicationEvent(Object)
71
+ * @see #ApplicationEvent(Object, Clock)
64
72
*/
65
73
public final long getTimestamp () {
66
74
return this .timestamp ;
0 commit comments