You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by GitBox <gi...@apache.org> on 2022/12/01 02:14:47 UTC

[GitHub] [incubator-eventmesh] weihubeats commented on a diff in pull request #2323: [ISSUE #2322] Simplify CloudEventUtils code

weihubeats commented on code in PR #2323:
URL: https://github.com/apache/incubator-eventmesh/pull/2323#discussion_r1036626235


##########
eventmesh-connector-plugin/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/utils/CloudEventUtils.java:
##########
@@ -42,53 +43,39 @@ public static SendResult convertSendResult(
 
     public static Message msgConvert(MessageExt rmqMsg) {
         Message message = new Message();
-        if (rmqMsg.getTopic() != null) {
-            message.setTopic(rmqMsg.getTopic());
-        }
-
-        if (rmqMsg.getKeys() != null) {
-            message.setKeys(rmqMsg.getKeys());
-        }
-
-        if (rmqMsg.getTags() != null) {
-            message.setTags(rmqMsg.getTags());
-        }
-
+        initProperty(rmqMsg, message, MessageExt::getTopic, Message::setTopic);
+        initProperty(rmqMsg, message, MessageExt::getKeys, Message::setKeys);
+        initProperty(rmqMsg, message, MessageExt::getTags, Message::setTags);
         if (rmqMsg.getBody() != null) {

Review Comment:
   What is the meaning of the same function mode, not quite understand



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org