-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fetch Mime Type From EnumDescriptor #72
Conversation
In lieu of a switch statement and static defining the mime type, pull the mime type from the proto generated code #71
src/main/java/org/eclipse/uprotocol/cloudevent/factory/UCloudEvent.java
Outdated
Show resolved
Hide resolved
@@ -467,24 +469,14 @@ static CloudEvent fromMessageParts(UUri source, UAttributes attributes, UPayload | |||
static UPayloadFormat getUPayloadFormatFromContentType(String contentType){ | |||
if(contentType == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
want to try using a Stream with a filter.
Nothing wrong with for loops and if statements - just saying.
This method is going to be called a lot - nice if it was efficient.
I take it the unit tests did not change and you ran them all. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done please re-review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving, please check in your tests that you do not throw exceptions or barf in any way, you have a strong contract that is someone gives you something you don't know, you return the default. Otherwise we would need to use an Optional or a Result.
You made a change that does not break the client contract, your tests should make sure of that.
Changing code to look nicer or be optimized is great refactoring, as long as you have tests to cover you.
In lieu of a switch statement and static defining the mime type, pull the mime type from the proto generated code
#71