Package io.jmix.ui.sys.event
Class UiEventListenerMethodAdapter
java.lang.Object
io.jmix.ui.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
ConstructorDescriptionUiEventListenerMethodAdapter
(Object instance, Class<?> targetClass, Method method, org.springframework.context.ApplicationEventPublisher applicationEventPublisher) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
assertTargetBean
(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 Object
Invoke the event listener method with the given argument values.protected String
Return the condition to use.protected String
getDetailedErrorMessage
(Object bean, String message) Add additional details such as the bean type and method signature to the given error message.protected String
getInvocationErrorMessage
(Object bean, String message, Object[] resolvedArgs) int
getOrder()
protected org.springframework.core.ResolvableType
getResolvableType
(org.springframework.context.ApplicationEvent event) protected void
handleResult
(Object instance, Object result) void
onApplicationEvent
(org.springframework.context.ApplicationEvent event) void
processEvent
(Object instance, org.springframework.context.ApplicationEvent event) Process the specifiedApplicationEvent
, checking if the condition match and handling non-null result, if any.protected void
publishEvent
(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 int
resolveOrder
(Method method) protected boolean
shouldHandle
(org.springframework.context.ApplicationEvent event, Object[] args) boolean
supportsEventType
(org.springframework.core.ResolvableType eventType) boolean
supportsSourceType
(Class<?> sourceType) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.event.GenericApplicationListener
supportsEventType
Methods 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:
supportsEventType
in interfaceorg.springframework.context.event.GenericApplicationListener
-
supportsSourceType
- Specified by:
supportsSourceType
in interfaceorg.springframework.context.event.SmartApplicationListener
-
onApplicationEvent
public void onApplicationEvent(@Nonnull org.springframework.context.ApplicationEvent event) - Specified by:
onApplicationEvent
in interfaceorg.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
-
getOrder
public int getOrder()- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
- Specified by:
getOrder
in 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
null
to 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
condition
attribute of theEventListener
annotation 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)
-