Class AnnotatedHandlerInspector<T>

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

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.
  • Method Details

    • inspectType

      public static <T> AnnotatedHandlerInspector<T> inspectType(Class<? extends 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<? extends 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<? extends 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<? extends 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
    • inspect

      public <C> AnnotatedHandlerInspector<C> inspect(Class<? extends C> entityType)
      Inspect another handler type and register the result to the inspector registry of this inspector. This is used by Axon to inspect child entities of an aggregate.
      Type Parameters:
      C - the handler's type
      Parameters:
      entityType - the type of the handler to inspect
      Returns:
      a new inspector for the given type
    • getHandlers

      @Deprecated public List<MessageHandlingMember<? super T>> getHandlers()
      Deprecated.
      Returns a list of detected members of the inspected entity that are capable of handling certain messages.
      Returns:
      a list of detected message handlers
    • getHandlers

      public Stream<MessageHandlingMember<? super T>> getHandlers(Class<?> type)
      Returns a list of detected members of given type that are capable of handling certain messages.
      Parameters:
      type - a type of inspected entity
      Returns:
      a stream of detected message handlers for given type
    • 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