Alonexc opened a new issue, #4261:
URL: https://github.com/apache/eventmesh/issues/4261

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Enhancement Request
   
   
![image](https://github.com/apache/eventmesh/assets/91315508/e5a85cf3-792e-4561-8750-ef2ddc65587f)
   
![image](https://github.com/apache/eventmesh/assets/91315508/2d198e1e-adc7-49d0-a105-cedc63730704)
   
![image](https://github.com/apache/eventmesh/assets/91315508/0199ac4a-b42b-4505-82aa-cd3d2c4d34bb)
   
![image](https://github.com/apache/eventmesh/assets/91315508/973088e9-ef82-4985-b778-21d667be5917)
   
![image](https://github.com/apache/eventmesh/assets/91315508/90b96614-7af8-4c48-aa84-916840dc8d5e)
   
![image](https://github.com/apache/eventmesh/assets/91315508/3d6709ee-c2f1-4bad-adad-a81a721bea6b)
   located at:
   
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/util/EventMeshCloudEventBuilder.java
   analysis and explanation:
   1. Local variable 'eventMeshMessage' and 'cloudEvent' is redundant.[145,194]
   2. Remove the parentheses around the "key" parameter[151]
   3. Can be replaced with 'Map.forEach()'.[164]
   4. Repeated code operations can be accomplished using a single 
method.[195-242]
   5. Unchecked cast: 
'java.util.Set<java.util.HashMap<java.lang.String,java.lang.String>>' to 'T'
   
   
   ### Describe the solution you'd like
   
   1. Inline variable
   2. Remove the parentheses around the "key" parameter
   3. Replaced with 'Map.forEach()'.
   
![image](https://github.com/apache/eventmesh/assets/91315508/eac58e8b-fba0-4190-9121-4f0c569f2817)
   4. Extract as a method.
   Constants.EVENTMESH_MESSAGE_CONST_TTL is the same as ProtocolKey.TTL.
   
![image](https://github.com/apache/eventmesh/assets/91315508/7c45e34d-a3b2-4649-9a6f-d65afb6a275a)
   
![image](https://github.com/apache/eventmesh/assets/91315508/c8e10019-04f3-4376-bead-a690923626c7)
   5. Add `@SuppressWarnings("unchecked")` to this method.
   
![image](https://github.com/apache/eventmesh/assets/91315508/b7f6929e-574d-4fcf-96a5-95dcac408662)
   
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to