-
Notifications
You must be signed in to change notification settings - Fork 0
[REFACTOR] Replace hand-written fromString() on enums with enumValueOf (Phase 11) #441
Copy link
Copy link
Open
Open
Copy link
Milestone
Description
Context
Several enums in edifikana/shared have hand-written fromString() companion object methods with manual when blocks. Kotlin's built-in enumValueOf<T>(value) does the same thing (throws IllegalArgumentException on unknown values) with less code and no custom logic to maintain.
This pattern was adopted before enumValueOf was in use in this project. New enums (TaskStatus, TaskPriority, and future additions) will use enumValueOf directly — this issue tracks updating the existing ones.
Enums to refactor
EventLogEventType—edifikana/shared/src/commonMain/kotlin/com/cramsan/edifikana/lib/model/EventLogEventType.kt- Any other enums in
edifikana/shared/src/commonMain/kotlin/com/cramsan/edifikana/lib/model/with afromString()companion method
Change
Remove the companion object { fun fromString(...) } block and update all call sites to use enumValueOf<EnumType>(value) (or enumValueOf<EnumType>(value ?: "") where nullability is needed).
Notes
- Verify all call sites before removing
fromString()— search the back-end and front-end for usages - New enums added going forward should not include
fromString()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels