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

    Constructors
    Constructor
    Description
    UiEventListenerMethodAdapter(Object instance, Class<?> targetClass, Method method, org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected 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
    doInvoke(Object instance, Object... args)
    Invoke the event listener method with the given argument values.
    protected String
    Return the condition to use.
    protected String
    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
     
    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 specified ApplicationEvent, 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 specified ApplicationEvent.
    protected List<org.springframework.core.ResolvableType>
    resolveDeclaredEventTypes(Method method, org.springframework.context.event.EventListener ann)
     
    protected int
     
    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.ApplicationListener

    supportsAsyncExecution

    Methods inherited from interface org.springframework.context.event.GenericApplicationListener

    supportsEventType

    Methods inherited from interface org.springframework.context.event.SmartApplicationListener

    getListenerId
  • Constructor Details

    • UiEventListenerMethodAdapter

      public UiEventListenerMethodAdapter(Object instance, Class<?> targetClass, Method method, org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
  • Method Details

    • supportsEventType

      public boolean supportsEventType(@Nonnull org.springframework.core.ResolvableType eventType)
      Specified by:
      supportsEventType in interface org.springframework.context.event.GenericApplicationListener
    • supportsSourceType

      public boolean supportsSourceType(@Nullable Class<?> sourceType)
      Specified by:
      supportsSourceType in interface org.springframework.context.event.SmartApplicationListener
    • onApplicationEvent

      public void onApplicationEvent(@Nonnull org.springframework.context.ApplicationEvent event)
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered
      Specified by:
      getOrder in interface org.springframework.context.event.SmartApplicationListener
    • resolveDeclaredEventTypes

      protected List<org.springframework.core.ResolvableType> resolveDeclaredEventTypes(Method method, @Nullable org.springframework.context.event.EventListener ann)
    • resolveOrder

      protected int resolveOrder(Method method)
    • processEvent

      public void processEvent(Object instance, org.springframework.context.ApplicationEvent event)
      Process the specified ApplicationEvent, checking if the condition match and handling non-null result, if any.
    • resolveArguments

      @Nullable protected Object[] resolveArguments(org.springframework.context.ApplicationEvent event)
      Resolve the method arguments to use for the specified ApplicationEvent.

      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

      protected void handleResult(Object instance, Object result)
    • publishEvent

      protected void publishEvent(Object instance, @Nullable Object event)
    • shouldHandle

      protected boolean shouldHandle(org.springframework.context.ApplicationEvent event, @Nullable Object[] args)
    • doInvoke

      @Nullable protected Object doInvoke(Object instance, @Nullable Object... args)
      Invoke the event listener method with the given argument values.
    • getCondition

      @Nullable protected String getCondition()
      Return the condition to use.

      Matches the condition attribute of the EventListener annotation or any matching attribute on a composed annotation that is meta-annotated with @EventListener.

    • getDetailedErrorMessage

      protected String getDetailedErrorMessage(Object bean, String message)
      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

      protected void assertTargetBean(Method method, Object targetBean, @Nullable Object[] args)
      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

      protected String getInvocationErrorMessage(Object bean, String message, @Nullable Object[] resolvedArgs)
    • getResolvableType

      @Nullable protected org.springframework.core.ResolvableType getResolvableType(org.springframework.context.ApplicationEvent event)