Class PayloadParameterResolver

java.lang.Object
org.axonframework.messaging.core.annotation.PayloadParameterResolver
All Implemented Interfaces:
ParameterResolver<Object>

public class PayloadParameterResolver extends Object implements ParameterResolver<Object>
Implementation of a ParameterResolver that resolves the Message payload as parameter in a handler method.
Since:
3.0.0
Author:
Allard Buijze
  • Constructor Details

    • PayloadParameterResolver

      public PayloadParameterResolver(Class<?> payloadType)
      Initializes a new PayloadParameterResolver for a method parameter of given payloadType. This parameter resolver matches with a message if the payload of the message is assignable to the given payloadType.
      Parameters:
      payloadType - the parameter type
  • Method Details

    • resolveParameterValue

      @Nonnull public CompletableFuture<Object> resolveParameterValue(@Nonnull ProcessingContext context)
      Description copied from interface: ParameterResolver
      Asynchronously resolves the parameter value from the context.
      Specified by:
      resolveParameterValue in interface ParameterResolver<Object>
      Parameters:
      context - The current processing context.
      Returns:
      A CompletableFuture that will complete with the parameter value, or completes with null.
    • matches

      public boolean matches(@Nonnull ProcessingContext context)
      Description copied from interface: ParameterResolver
      Indicates whether this resolver is capable of providing a value for the given context.
      Specified by:
      matches in interface ParameterResolver<Object>
      Parameters:
      context - The current processing context.
      Returns:
      Returns true if this resolver can provide a value for the message, otherwise false.
    • supportedPayloadType

      public Class<?> supportedPayloadType()
      Description copied from interface: ParameterResolver
      Returns the class of the payload that is supported by this resolver. Defaults to the Object class indicating that the payload type is irrelevant for this resolver.
      Specified by:
      supportedPayloadType in interface ParameterResolver<Object>
      Returns:
      The class of the payload that is supported by this resolver