Closed pekam closed 7 years ago
Reviewed 2 of 2 files at r1. Review status: all files reviewed at latest revision, 3 unresolved discussions.
src/main/java/com/vaadin/flow/demo/patientportal/converters/GenderToStringConverter.java, line 29 at r1 (raw file):
@Override public String toPresentation(Gender modelValue) { return modelValue.name().toLowerCase();
Just return name.
src/main/java/com/vaadin/flow/demo/patientportal/converters/GenderToStringConverter.java, line 35 at r1 (raw file):
public Gender toModel(String presentationValue) { if (presentationValue != null) { for (Gender gender : Gender.values()) {
Use Gender.valueOf()
src/main/java/com/vaadin/flow/demo/patientportal/converters/GenderToStringConverter.java, line 41 at r1 (raw file):
} } throw new IllegalArgumentException(
Better throw all the exceptions early, if possible.
In this case, you can invert if
clause and get a better readability.
Comments from Reviewable
Reviewed 1 of 1 files at r2. Review status: all files reviewed at latest revision, 4 unresolved discussions.
src/main/java/com/vaadin/flow/demo/patientportal/converters/GenderToStringConverter.java, line 29 at r2 (raw file):
@Override public String toPresentation(Gender modelValue) { return modelValue.name().toLowerCase();
So, why cannot you just return modelValue.name()
here and not use presentationValue.toUpperCase()
at the bottom?
Comments from Reviewable
Review status: all files reviewed at latest revision, 4 unresolved discussions.
src/main/java/com/vaadin/flow/demo/patientportal/converters/GenderToStringConverter.java, line 29 at r1 (raw file):
Just return name.
I don't want to. It looks ugly to have capital letters like: "Gender: MALE" in the UI.
src/main/java/com/vaadin/flow/demo/patientportal/converters/GenderToStringConverter.java, line 35 at r1 (raw file):
Use `Gender.valueOf()`
Done.
src/main/java/com/vaadin/flow/demo/patientportal/converters/GenderToStringConverter.java, line 41 at r1 (raw file):
Better throw all the exceptions early, if possible. In this case, you can invert `if` clause and get a better readability.
I just let the Gender.valueOf()
throw the exceptions
Comments from Reviewable
Review status: all files reviewed at latest revision, 4 unresolved discussions.
src/main/java/com/vaadin/flow/demo/patientportal/converters/GenderToStringConverter.java, line 29 at r2 (raw file):
So, why cannot you just return `modelValue.name()` here and not use `presentationValue.toUpperCase()` at the bottom?
see above
Comments from Reviewable
Add all missing properties for patient-profile view, convert Gender into a String.
This change is