org.springframework.context.event

Class ApplicationListenerMethodAdapter

  • java.lang.Object
    • org.springframework.context.event.ApplicationListenerMethodAdapter
    • Constructor Summary

      Constructors 
      Constructor and Description
      ApplicationListenerMethodAdapter(java.lang.String beanName, java.lang.Class<?> targetClass, java.lang.reflect.Method method) 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      protected java.lang.Object doInvoke(java.lang.Object... args)
      Invoke the event listener method with the given argument values.
      protected java.lang.String getCondition()
      Return the condition to use.
      protected java.lang.String getDetailedErrorMessage(java.lang.Object bean, java.lang.String message)
      Add additional details such as the bean type and method signature to the given error message.
      int getOrder()
      Determine this listener's order in a set of listeners for the same event.
      protected java.lang.Object getTargetBean()
      Return the target bean instance to use.
      protected void handleResult(java.lang.Object result) 
      void onApplicationEvent(ApplicationEvent event)
      Handle an application event.
      void processEvent(ApplicationEvent event)
      Process the specified ApplicationEvent, checking if the condition match and handling non-null result, if any.
      protected java.lang.Object[] resolveArguments(ApplicationEvent event)
      Resolve the method arguments to use for the specified ApplicationEvent.
      boolean supportsEventType(ResolvableType eventType)
      Determine whether this listener actually supports the given event type.
      boolean supportsSourceType(java.lang.Class<?> sourceType)
      Determine whether this listener actually supports the given source type.
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • logger

        protected final Log logger
    • Constructor Detail

      • ApplicationListenerMethodAdapter

        public ApplicationListenerMethodAdapter(java.lang.String beanName,
                                                java.lang.Class<?> targetClass,
                                                java.lang.reflect.Method method)
    • Method Detail

      • supportsSourceType

        public boolean supportsSourceType(@Nullable
                                          java.lang.Class<?> sourceType)
        Description copied from interface: GenericApplicationListener
        Determine whether this listener actually supports the given source type.

        The default implementation always returns true.

        Specified by:
        supportsSourceType in interface GenericApplicationListener
        Parameters:
        sourceType - the source type, or null if no source
      • processEvent

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

        @Nullable
        protected java.lang.Object[] resolveArguments(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(java.lang.Object result)
      • doInvoke

        @Nullable
        protected java.lang.Object doInvoke(java.lang.Object... args)
        Invoke the event listener method with the given argument values.
      • getTargetBean

        protected java.lang.Object getTargetBean()
        Return the target bean instance to use.
      • getCondition

        @Nullable
        protected java.lang.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 java.lang.String getDetailedErrorMessage(java.lang.Object bean,
                                                           java.lang.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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object