Skip to content

[Enhancement] Some optimizations to EventMeshCloudEventUtils. #4262

@Alonexc

Description

@Alonexc

Search before asking

  • I had searched in the issues and found no similar issues.

Enhancement Request

image
image
image
image
located at:
eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/common/EventMeshCloudEventUtils.java
analysis and explanation:

  1. Repeated code operations can be accomplished using a single method.
  2. Passing a non-null argument to 'Optional'.[366,383]
  3. Condition 'protoData == null' and 'binaryData == null' is always 'false'.[370,374]
  4. 'return' is unnecessary as the last statement in a 'void' method[416]

Describe the solution you'd like

  1. Extract as a method.
    image
  2. Replace with 'Optional.of()'
    image
  3. Remove
    image
  4. Remove unnecessary return.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgood first issueIssues for first-time contributors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions