From 1e2e114e3c984429017ad5985516f38548b058c5 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Wed, 26 May 2021 14:46:32 +0200 Subject: [PATCH] Polish contribution See gh-26871 --- .../context/ApplicationEvent.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/context/ApplicationEvent.java b/spring-context/src/main/java/org/springframework/context/ApplicationEvent.java index f54d7b91c8..fc059249a9 100644 --- a/spring-context/src/main/java/org/springframework/context/ApplicationEvent.java +++ b/spring-context/src/main/java/org/springframework/context/ApplicationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,9 +38,11 @@ public abstract class ApplicationEvent extends EventObject { /** - * Create a new {@code ApplicationEvent}. + * Create a new {@code ApplicationEvent} with its {@link #getTimestamp() timestamp} + * set to {@link System#currentTimeMillis()}. * @param source the object on which the event initially occurred or with * which the event is associated (never {@code null}) + * @see #ApplicationEvent(Object, Clock) */ public ApplicationEvent(Object source) { super(source); @@ -48,10 +50,14 @@ public abstract class ApplicationEvent extends EventObject { } /** - * Create a new {@code ApplicationEvent} with a fixed timestamp. + * Create a new {@code ApplicationEvent} with its {@link #getTimestamp() timestamp} + * set to the value returned by {@link Clock#millis()} in the provided {@link Clock}. + *

This constructor is typically used in testing scenarios. * @param source the object on which the event initially occurred or with * which the event is associated (never {@code null}) * @param clock a clock which will provide the timestamp + * @since 5.3.8 + * @see #ApplicationEvent(Object) */ public ApplicationEvent(Object source, Clock clock) { super(source); @@ -60,7 +66,9 @@ public abstract class ApplicationEvent extends EventObject { /** - * Return the system time in milliseconds when the event occurred. + * Return the time in milliseconds when the event occurred. + * @see #ApplicationEvent(Object) + * @see #ApplicationEvent(Object, Clock) */ public final long getTimestamp() { return this.timestamp;