Polishing

This commit is contained in:
Juergen Hoeller
2024-01-05 10:08:57 +01:00
parent fb4fbeab50
commit 07097976ef
14 changed files with 29 additions and 30 deletions

View File

@@ -55,6 +55,7 @@ public interface GenericApplicationListener extends SmartApplicationListener {
*/
boolean supportsEventType(ResolvableType eventType);
/**
* Create a new {@code ApplicationListener} for the given event type.
* @param eventType the event to listen to

View File

@@ -22,8 +22,7 @@ import org.springframework.context.ApplicationEvent;
import org.springframework.core.ResolvableType;
/**
* A {@link GenericApplicationListener} implementation that supports a single
* event type.
* A {@link GenericApplicationListener} implementation that supports a single event type.
*
* @author Stephane Nicoll
* @since 6.1.3
@@ -35,11 +34,13 @@ class GenericApplicationListenerDelegate<E extends ApplicationEvent> implements
private final Consumer<E> consumer;
GenericApplicationListenerDelegate(Class<E> supportedEventType, Consumer<E> consumer) {
this.supportedEventType = supportedEventType;
this.consumer = consumer;
}
@Override
public void onApplicationEvent(ApplicationEvent event) {
this.consumer.accept(this.supportedEventType.cast(event));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
@@ -168,7 +168,7 @@ public final class CronExpression {
* the cron format
*/
public static CronExpression parse(String expression) {
Assert.hasLength(expression, "Expression string must not be empty");
Assert.hasLength(expression, "Expression must not be empty");
expression = resolveMacros(expression);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 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.
@@ -848,6 +848,7 @@ class CronTriggerTests {
assertThat(nextExecutionTime).isEqualTo(this.calendar.getTime());
}
private static void roundup(Calendar calendar) {
calendar.add(Calendar.SECOND, 1);
calendar.set(Calendar.MILLISECOND, 0);
@@ -861,9 +862,7 @@ class CronTriggerTests {
}
private static TriggerContext getTriggerContext(Date lastCompletionTime) {
SimpleTriggerContext context = new SimpleTriggerContext();
context.update(null, null, lastCompletionTime);
return context;
return new SimpleTriggerContext(null, null, lastCompletionTime);
}