• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

TAKETODAY / today-infrastructure / 18154768944

01 Oct 2025 07:26AM UTC coverage: 81.882% (-0.005%) from 81.887%
18154768944

push

github

web-flow
Merge pull request #290 from TAKETODAY/dev/jspecify

jspecify

59788 of 78013 branches covered (76.64%)

Branch coverage included in aggregate %.

141239 of 167496 relevant lines covered (84.32%)

3.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
today-context/src/main/java/infra/context/event/SmartApplicationListener.java
1
/*
2
 * Copyright 2017 - 2025 the original author or authors.
3
 *
4
 * This program is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation, either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program. If not, see [https://www.gnu.org/licenses/]
16
 */
17

18
package infra.context.event;
19

20
import org.jspecify.annotations.Nullable;
21

22
import infra.context.ApplicationEvent;
23
import infra.context.ApplicationListener;
24
import infra.core.Ordered;
25

26
/**
27
 * Extended variant of the standard {@link ApplicationListener} interface,
28
 * exposing further metadata such as the supported event and source type.
29
 *
30
 * <p>For full introspection of generic event types, consider implementing
31
 * the {@link GenericApplicationListener} interface instead.
32
 *
33
 * @author Juergen Hoeller
34
 * @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
35
 * @see GenericApplicationListener
36
 * @see GenericApplicationListenerAdapter
37
 * @since 4.0
38
 */
39
public interface SmartApplicationListener extends ApplicationListener<ApplicationEvent>, Ordered {
40

41
  /**
42
   * Determine whether this listener actually supports the given event type.
43
   *
44
   * @param eventType the event type (never {@code null})
45
   */
46
  boolean supportsEventType(Class<? extends ApplicationEvent> eventType);
47

48
  /**
49
   * Determine whether this listener actually supports the given source type.
50
   * <p>The default implementation always returns {@code true}.
51
   *
52
   * @param sourceType the source type, or {@code null} if no source
53
   */
54
  default boolean supportsSourceType(@Nullable Class<?> sourceType) {
55
    return true;
2✔
56
  }
57

58
  /**
59
   * Determine this listener's order in a set of listeners for the same event.
60
   * <p>The default implementation returns {@link #LOWEST_PRECEDENCE}.
61
   */
62
  @Override
63
  default int getOrder() {
64
    return LOWEST_PRECEDENCE;
2✔
65
  }
66

67
  /**
68
   * Return an optional identifier for the listener.
69
   * <p>The default value is an empty String.
70
   *
71
   * @see EventListener#id
72
   * @see ApplicationEventMulticaster#removeApplicationListeners
73
   */
74
  default String getListenerId() {
75
    return "";
×
76
  }
77

78
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc