Skip to content

Improve VisitTypeHelper type safety and modernize usage#521

Open
Manas-Dikshit wants to merge 1 commit intoopenmrs:masterfrom
Manas-Dikshit:master
Open

Improve VisitTypeHelper type safety and modernize usage#521
Manas-Dikshit wants to merge 1 commit intoopenmrs:masterfrom
Manas-Dikshit:master

Conversation

@Manas-Dikshit
Copy link

Replace the deprecated Boolean(String) constructor in the patient header visit type flag with Boolean.parseBoolean.
Make JSON deserialization of the visit type ordering global property type-safe by deserializing into Map<String, String> instead of a raw HashMap.
Use the diamond operator and modern generic collection instantiation throughout VisitTypeHelper to reduce noise and remove unchecked warnings.
Details

showVisitTypeOnPatientHeaderSection now parses the global property via Boolean.parseBoolean, eliminating the deprecated boxed constructor and avoiding unnecessary allocation.
getOrderedVisitTypes now uses ObjectMapper.readValue with a TypeReference<Map<String, String>>, which aligns the map key type with the existing "1", "2", … index keys and removes the suspicious Map.get/unchecked conversion warnings.
Collection instantiations have been updated to use new ArrayList<>(), new HashMap<>(), and new LinkedHashMap<>() for clearer, more idiomatic Java.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant