From f08cf0e86462a041a560332a45fde6ab473faccc Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Tue, 19 Nov 2019 16:03:43 +0000 Subject: [PATCH] Add RSocketFrameTypeMessageCondition constants See gh-23999 --- .../RSocketFrameTypeMessageCondition.java | 65 ++++++++++++------- 1 file changed, 43 insertions(+), 22 deletions(-) diff --git a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketFrameTypeMessageCondition.java b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketFrameTypeMessageCondition.java index 3288df528087..7ae1c1bf9ca1 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketFrameTypeMessageCondition.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketFrameTypeMessageCondition.java @@ -45,6 +45,45 @@ public class RSocketFrameTypeMessageCondition extends AbstractMessageCondition frameTypeConditionCache; @@ -56,13 +95,6 @@ public class RSocketFrameTypeMessageCondition extends AbstractMessageCondition frameTypes; @@ -179,27 +211,16 @@ public static RSocketFrameTypeMessageCondition getCondition(int cardinalityIn, i case 0: case 1: switch (cardinalityOut) { - case 0: return FF_RR_CONDITION; - case 1: return RR_CONDITION; - case 2: return RS_CONDITION; + case 0: return REQUEST_FNF_OR_RESPONSE_CONDITION; + case 1: return REQUEST_RESPONSE_CONDITION; + case 2: return REQUEST_STREAM_CONDITION; default: throw new IllegalStateException("Invalid cardinality: " + cardinalityOut); } case 2: - return RC_CONDITION; + return REQUEST_CHANNEL_CONDITION; default: throw new IllegalStateException("Invalid cardinality: " + cardinalityIn); } } - - private static final RSocketFrameTypeMessageCondition FF_CONDITION = from(FrameType.REQUEST_FNF); - private static final RSocketFrameTypeMessageCondition RR_CONDITION = from(FrameType.REQUEST_RESPONSE); - private static final RSocketFrameTypeMessageCondition RS_CONDITION = from(FrameType.REQUEST_STREAM); - private static final RSocketFrameTypeMessageCondition RC_CONDITION = from(FrameType.REQUEST_CHANNEL); - private static final RSocketFrameTypeMessageCondition FF_RR_CONDITION = FF_CONDITION.combine(RR_CONDITION); - - private static RSocketFrameTypeMessageCondition from(FrameType... frameTypes) { - return new RSocketFrameTypeMessageCondition(frameTypes); - } - }