use of org.springframework.messaging.handler.MessageCondition in project spring-framework by spring-projects.
the class RSocketMessageHandler method extendMapping.
@Override
protected CompositeMessageCondition extendMapping(CompositeMessageCondition composite, HandlerMethod handler) {
List<MessageCondition<?>> conditions = composite.getMessageConditions();
Assert.isTrue(conditions.size() == 2 && conditions.get(0) instanceof RSocketFrameTypeMessageCondition && conditions.get(1) instanceof DestinationPatternsMessageCondition, "Unexpected message condition types");
if (conditions.get(0) != RSocketFrameTypeMessageCondition.EMPTY_CONDITION) {
return composite;
}
int responseCardinality = getCardinality(handler.getReturnType());
int requestCardinality = 0;
for (MethodParameter parameter : handler.getMethodParameters()) {
if (getArgumentResolvers().getArgumentResolver(parameter) instanceof PayloadMethodArgumentResolver) {
requestCardinality = getCardinality(parameter);
}
}
return new CompositeMessageCondition(RSocketFrameTypeMessageCondition.getCondition(requestCardinality, responseCardinality), conditions.get(1));
}
Aggregations