Class AnnotatedHandlerInspector<T>

java.lang.Object
org.axonframework.messaging.core.annotation.AnnotatedHandlerInspector<T>
Type Parameters:
T - The target type.

@Internal public class AnnotatedHandlerInspector<T> extends Object
Inspector for a message handling target of type T that uses annotations on the target to inspect the capabilities of the target.
Since:
3.0.0
Author:
Allard Buijze
  • Method Details

    • inspectType

      public static <T> AnnotatedHandlerInspector<T> inspectType(Class<T> handlerType)
      Create an inspector for given handlerType that uses a ClasspathParameterResolverFactory to resolve method parameters and ClasspathHandlerDefinition to create handlers.
      Type Parameters:
      T - the handler's type
      Parameters:
      handlerType - the target handler type
      Returns:
      a new inspector instance for the inspected class
    • inspectType

      public static <T> AnnotatedHandlerInspector<T> inspectType(Class<T> handlerType, ParameterResolverFactory parameterResolverFactory)
      Create an inspector for given handlerType that uses given parameterResolverFactory to resolve method parameters.
      Type Parameters:
      T - the handler's type
      Parameters:
      handlerType - the target handler type
      parameterResolverFactory - the resolver factory to use during detection
      Returns:
      a new inspector instance for the inspected class
    • inspectType

      public static <T> AnnotatedHandlerInspector<T> inspectType(Class<T> handlerType, ParameterResolverFactory parameterResolverFactory, HandlerDefinition handlerDefinition)
      Create an inspector for given handlerType that uses given parameterResolverFactory to resolve method parameters and given handlerDefinition to create handlers.
      Type Parameters:
      T - the handler's type
      Parameters:
      handlerType - the target handler type
      parameterResolverFactory - the resolver factory to use during detection
      handlerDefinition - the handler definition used to create concrete handlers
      Returns:
      a new inspector instance for the inspected class
    • inspectType

      public static <T> AnnotatedHandlerInspector<T> inspectType(Class<T> handlerType, ParameterResolverFactory parameterResolverFactory, HandlerDefinition handlerDefinition, Set<Class<? extends T>> declaredSubtypes)
      Create an inspector for given handlerType and its declaredSubtypes that uses given parameterResolverFactory to resolve method parameters and given handlerDefinition to create handlers.
      Type Parameters:
      T - the handler's type
      Parameters:
      handlerType - the target handler type
      parameterResolverFactory - the resolver factory to use during detection
      handlerDefinition - the handler definition used to create concrete handlers
      declaredSubtypes - the declared subtypes of this handlerType
      Returns:
      a new inspector instance for the inspected class
    • getHandlers

      public SortedSet<MessageHandlingMember<? super T>> getHandlers(Class<?> type)
      Returns a sorted set of detected members of given type that are capable of handling certain messages.
      Parameters:
      type - a type of inspected entity
      Returns:
      a sorted set of detected message handlers for given type
    • getUniqueHandlers

      public List<MessageHandlingMember<? super T>> getUniqueHandlers(Class<?> type, Class<? extends Message> messageType)
      Returns a list of detected members of given type, that can handle messages of messageType. The list is further filtered to exclude any duplicate members that resolve to the same Executable.
      Parameters:
      type - a type of inspected entity
      messageType - a message type the returned handlers must be able to handle
      Returns:
      a list of unique detected message handlers for given type, that can handle messages of messageType
    • chainedInterceptor

      public MessageHandlerInterceptorMemberChain<T> chainedInterceptor(Class<?> type)
      Returns an Interceptor Chain of annotated interceptor methods defined on the given type. The given chain will invoke all relevant interceptors in an order defined by the handler definition.
      Parameters:
      type - The type containing the handler definitions
      Returns:
      an interceptor chain that invokes the interceptor handlers defined on the inspected type
    • getAllHandlers

      public Map<Class<?>,SortedSet<MessageHandlingMember<? super T>>> getAllHandlers()
      Gets all handlers per type for inspected entity. Handlers are sorted based on HandlerComparator.
      Returns:
      a map of handlers per type
    • getAllInterceptors

      public Map<Class<?>,SortedSet<MessageHandlingMember<? super T>>> getAllInterceptors()
      Returns a Map of all registered interceptor methods per inspected type. Each entry contains the inspected type as key, and a SortedSet of interceptor methods defined on that type, in the order they are considered for invocation.
      Returns:
      a map of interceptors per type
    • getAllInspectedTypes

      public Set<Class<?>> getAllInspectedTypes()
      Returns a Set of all types which have been inspected for handlers.
      Returns:
      a Set of all types which have been inspected for handlers