public final class GenericExecutableApplicationListener extends Object implements org.springframework.context.event.SmartApplicationListener
Associate an executable with one or more Spring framework application events.
If an application event gets fired where both supportsEventType and supportsSourceType return true, onApplicationEvent invokes the executable.
The default behavior of supportsEventType and supportsSourceType is to always return true irrespective of what application event was fired.
To be more discriminatory, provide values for supportedSourceTypes and supportedEventTypes.
To limit execution to a specific event type, eg ContextRefreshedEvent:
ExecutableApplicationListener.builder(executable).supportedEventType(ContextRefreshedEvent.class).build()
| Modifier and Type | Class and Description |
|---|---|
static class |
GenericExecutableApplicationListener.Builder |
| Modifier and Type | Method and Description |
|---|---|
static GenericExecutableApplicationListener.Builder |
builder(Executable executable) |
Executable |
getExecutable() |
int |
getOrder() |
List<Class<? extends org.springframework.context.ApplicationEvent>> |
getSupportedEventTypes() |
List<Class<?>> |
getSupportedSourceTypes() |
void |
onApplicationEvent(org.springframework.context.ApplicationEvent event) |
boolean |
supportsEventType(Class<? extends org.springframework.context.ApplicationEvent> eventType) |
boolean |
supportsSourceType(Class<?> sourceType) |
public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>public int getOrder()
getOrder in interface org.springframework.core.Orderedpublic boolean supportsEventType(Class<? extends org.springframework.context.ApplicationEvent> eventType)
supportsEventType in interface org.springframework.context.event.SmartApplicationListenerpublic boolean supportsSourceType(Class<?> sourceType)
supportsSourceType in interface org.springframework.context.event.SmartApplicationListenerpublic static GenericExecutableApplicationListener.Builder builder(Executable executable)
public Executable getExecutable()
public List<Class<?>> getSupportedSourceTypes()
public List<Class<? extends org.springframework.context.ApplicationEvent>> getSupportedEventTypes()
Copyright © 2010–2014 The Kuali Foundation. All rights reserved.