Class MetadataParameterResolver
java.lang.Object
io.fluxzero.common.handling.TypedParameterResolver<Object>
io.fluxzero.sdk.tracking.handling.MetadataParameterResolver
- All Implemented Interfaces:
ParameterResolver<Object>
Resolves handler method parameters of type
Metadata.
This resolver can inject metadata into handler methods in two ways:
- If the message being handled implements
HasMetadata, its metadata is directly returned. - Otherwise, the metadata is extracted from the current
DeserializingMessage(if available).
Example handler:
@HandleCommand
public void handle(MyCommand command, Metadata metadata) {
String user = metadata.get("userId");
}
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class TypedParameterResolver
matches, mayApplyMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ParameterResolver
determinesSpecificity, specificityPriority, test
-
Constructor Details
-
MetadataParameterResolver
public MetadataParameterResolver()
-
-
Method Details
-
resolve
Description copied from interface:ParameterResolverResolves aParameterof a handler method into a value function based on the given message.If the parameter cannot be resolved by this resolver and
ParameterResolver.matches(Parameter, Annotation, M)is not implemented, this method must returnnull.- Parameters:
p- the parameter to resolvemethodAnnotation- the annotation present on the handler method (e.g.,@HandleEvent)- Returns:
- a function that takes a message and returns a value to be injected into the method parameter, or
nullif the parameter cannot be resolved andParameterResolver.matches(Parameter, Annotation, M)is not implemented.
-