Class MessageParameterResolver
java.lang.Object
io.fluxzero.sdk.tracking.handling.MessageParameterResolver
- All Implemented Interfaces:
ParameterResolver<Object>
Resolves handler method parameters of type
DeserializingMessage.
This allows handler methods to access the deserialization context, including message metadata, payload, and raw serialized content.
Useful when advanced information about the message is needed, such as the Fluxzero-assigned message index.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanmatches(Parameter parameter, Annotation methodAnnotation, Object value) Indicates whether the resolved value is compatible with the declared parameter type.booleanmayApply(Executable method, Class<?> targetClass) Returnstrueif this resolver might apply to the given method.resolve(Parameter p, Annotation methodAnnotation) Resolves aParameterof a handler method into a value function based on the given message.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ParameterResolver
determinesSpecificity, test
-
Constructor Details
-
MessageParameterResolver
public MessageParameterResolver()
-
-
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.- Specified by:
resolvein interfaceParameterResolver<Object>- 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.
-
matches
Description copied from interface:ParameterResolverIndicates whether the resolved value is compatible with the declared parameter type.This method helps determine whether the parameter can be injected for a given message. It first invokes
ParameterResolver.resolve(Parameter, Annotation)and then verifies that the returned value (if any) is assignable to the parameter type.- Specified by:
matchesin interfaceParameterResolver<Object>- Parameters:
parameter- the parameter being checkedmethodAnnotation- the annotation on the handler methodvalue- the message instance to use for resolution- Returns:
trueif the parameter can be resolved and assigned to,falseotherwise
-
mayApply
Description copied from interface:ParameterResolverReturnstrueif this resolver might apply to the given method. Implementations should perform only inexpensive checks and never throw.- Specified by:
mayApplyin interfaceParameterResolver<Object>- Parameters:
method- the handler method or constructortargetClass- the declaring or target class- Returns:
trueif this resolver could apply,falseotherwise
-