Package io.jmix.flowui.sys.event
Class UiEventListenerMethodAdapter
java.lang.Object
io.jmix.flowui.sys.event.UiEventListenerMethodAdapter
- All Implemented Interfaces:
EventListener,org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>,org.springframework.context.event.GenericApplicationListener,org.springframework.context.event.SmartApplicationListener,org.springframework.core.Ordered
public class UiEventListenerMethodAdapter
extends Object
implements org.springframework.context.event.GenericApplicationListener
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionUiEventListenerMethodAdapter(Object instance, Class<?> targetClass, Method method, org.springframework.context.ApplicationEventPublisher applicationEventPublisher) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertTargetBean(Method method, Object targetBean, Object[] args) Assert that the target bean class is an instance of the class where the given method is declared.protected ObjectInvoke the event listener method with the given argument values.protected StringReturn the condition to use.protected StringgetDetailedErrorMessage(Object bean, String message) Add additional details such as the bean type and method signature to the given error message.protected StringgetInvocationErrorMessage(Object bean, String message, Object[] resolvedArgs) intgetOrder()protected org.springframework.core.ResolvableTypegetResolvableType(org.springframework.context.ApplicationEvent event) protected voidhandleResult(Object instance, Object result) voidonApplicationEvent(org.springframework.context.ApplicationEvent event) voidprocessEvent(Object instance, org.springframework.context.ApplicationEvent event) Process the specifiedApplicationEvent, checking if the condition match and handling non-null result, if any.protected voidpublishEvent(Object instance, Object event) protected Object[]resolveArguments(org.springframework.context.ApplicationEvent event) Resolve the method arguments to use for the specifiedApplicationEvent.protected List<org.springframework.core.ResolvableType>resolveDeclaredEventTypes(Method method, org.springframework.context.event.EventListener ann) protected intresolveOrder(Method method) protected booleanshouldHandle(org.springframework.context.ApplicationEvent event, Object[] args) booleansupportsEventType(org.springframework.core.ResolvableType eventType) booleansupportsSourceType(Class<?> sourceType) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.event.GenericApplicationListener
supportsEventTypeMethods inherited from interface org.springframework.context.event.SmartApplicationListener
getListenerId
-
Constructor Details
-
UiEventListenerMethodAdapter
-
-
Method Details
-
supportsEventType
public boolean supportsEventType(@Nonnull org.springframework.core.ResolvableType eventType) - Specified by:
supportsEventTypein interfaceorg.springframework.context.event.GenericApplicationListener
-
supportsSourceType
- Specified by:
supportsSourceTypein interfaceorg.springframework.context.event.SmartApplicationListener
-
onApplicationEvent
public void onApplicationEvent(@Nonnull org.springframework.context.ApplicationEvent event) - Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered- Specified by:
getOrderin interfaceorg.springframework.context.event.SmartApplicationListener
-
resolveDeclaredEventTypes
-
resolveOrder
-
processEvent
Process the specifiedApplicationEvent, checking if the condition match and handling non-null result, if any. -
resolveArguments
Resolve the method arguments to use for the specifiedApplicationEvent.These arguments will be used to invoke the method handled by this instance. Can return
nullto indicate that no suitable arguments could be resolved and therefore the method should not be invoked at all for the specified event. -
handleResult
-
publishEvent
-
shouldHandle
protected boolean shouldHandle(org.springframework.context.ApplicationEvent event, @Nullable Object[] args) -
doInvoke
Invoke the event listener method with the given argument values. -
getCondition
Return the condition to use.Matches the
conditionattribute of theEventListenerannotation or any matching attribute on a composed annotation that is meta-annotated with@EventListener. -
getDetailedErrorMessage
Add additional details such as the bean type and method signature to the given error message.- Parameters:
message- error message to append the HandlerMethod details to
-
assertTargetBean
Assert that the target bean class is an instance of the class where the given method is declared. In some cases the actual bean instance at event- processing time may be a JDK dynamic proxy (lazy initialization, prototype beans, and others). Event listener beans that require proxying should prefer class-based proxy mechanisms. -
getInvocationErrorMessage
-
getResolvableType
@Nullable protected org.springframework.core.ResolvableType getResolvableType(org.springframework.context.ApplicationEvent event)
-