Class HandlerAssociations
java.lang.Object
io.fluxzero.sdk.tracking.handling.HandlerAssociations
Shared utility for discovering and evaluating
Association definitions on handler types and handler methods.
This class centralizes association behavior that is shared between different handler implementations, such as
StatefulHandler and SocketEndpointHandler. It can:
- inspect field-, method-, and parameter-level
@Associationdeclarations - resolve association values from an incoming
DeserializingMessage - match a concrete handler instance against computed association values
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Constructor Summary
ConstructorsConstructorDescriptionHandlerAssociations(@NonNull Class<?> targetClass, List<ParameterResolver<? super DeserializingMessage>> parameterResolvers, Function<Executable, ? extends Annotation> methodAnnotationProvider) Creates an association helper for a specific handler type. -
Method Summary
Modifier and TypeMethodDescriptionbooleanalwaysAssociate(Executable executable) protected List<ParameterResolver<? super DeserializingMessage>> applicableParameterResolvers(Executable executable) associations(DeserializingMessage message, Stream<Executable> matchingMethods) Computes the association values contributed by the given message for the supplied matching handler methods.computeMethodAssociationProperties(Executable executable) Returns the association definitions declared on the handler type itself, keyed by message property name.getMethodAssociationProperties(Executable executable) Returns the association definitions contributed by a handler executable, including parameter-level@Associationdeclarations.protected booleanincludedPayload(Object payload, HandlerAssociations.AssociationValue association) booleanmatchesTarget(Object target, Map<Object, String> associations) Returns whether the given handler instance matches any of the computed association values.protected booleanmatchesValue(Object targetValue, Object associationValue) protected booleanmayApply(ParameterResolver<? super DeserializingMessage> resolver, Executable executable) protected ObjectnormalizeAssociationValue(Object value) protected ObjectresolveParameterValue(Executable executable, Parameter parameter, Annotation methodAnnotation, DeserializingMessage message)
-
Constructor Details
-
HandlerAssociations
public HandlerAssociations(@NonNull @NonNull Class<?> targetClass, List<ParameterResolver<? super DeserializingMessage>> parameterResolvers, Function<Executable, ? extends Annotation> methodAnnotationProvider) Creates an association helper for a specific handler type.- Parameters:
targetClass- the handler class whose association metadata should be inspectedparameterResolvers- the parameter resolvers used to resolve parameter-level@AssociationsourcesmethodAnnotationProvider- provider for the effective handler annotation on an executable, used when resolving parameter values
-
-
Method Details
-
getAssociationProperties
Returns the association definitions declared on the handler type itself, keyed by message property name. -
getMethodAssociationProperties
public List<HandlerAssociations.MethodAssociationProperty> getMethodAssociationProperties(Executable executable) Returns the association definitions contributed by a handler executable, including parameter-level@Associationdeclarations. -
associations
public Map<Object,String> associations(DeserializingMessage message, Stream<Executable> matchingMethods) Computes the association values contributed by the given message for the supplied matching handler methods.The returned map is keyed by association value and contains the target path within the handler instance that should be matched for that value.
-
matchesTarget
-
matchesValue
-
normalizeAssociationValue
-
includedPayload
-
computeMethodAssociationProperties
protected List<HandlerAssociations.MethodAssociationProperty> computeMethodAssociationProperties(Executable executable) -
alwaysAssociate
-
resolveParameterValue
protected Object resolveParameterValue(Executable executable, Parameter parameter, Annotation methodAnnotation, DeserializingMessage message) -
applicableParameterResolvers
protected List<ParameterResolver<? super DeserializingMessage>> applicableParameterResolvers(Executable executable) -
mayApply
protected boolean mayApply(ParameterResolver<? super DeserializingMessage> resolver, Executable executable)
-