The current API in the Preferences classes is String-based. This means that it is unclear from the caller what the actual value of the String should be. In my case, instead of using WatchDogUtils.getWorkspaceName() I used project.name in the project registration. Since they are both Strings, it would compile fine. However, all other logic and call-sides of the API used the former rather than the latter.
Therefore, to make this more type-safe, changing the API to use Project instead is more clear. In this case, it should be possible to obtain this project in only 1 way, to make sure the API can only be called with that value. That way, it is clear from the call-side how to retrieve the value, as we limit the amount of possibilities.
The current API in the
Preferences
classes is String-based. This means that it is unclear from the caller what the actual value of the String should be. In my case, instead of usingWatchDogUtils.getWorkspaceName()
I usedproject.name
in the project registration. Since they are both Strings, it would compile fine. However, all other logic and call-sides of the API used the former rather than the latter.Therefore, to make this more type-safe, changing the API to use
Project
instead is more clear. In this case, it should be possible to obtain this project in only 1 way, to make sure the API can only be called with that value. That way, it is clear from the call-side how to retrieve the value, as we limit the amount of possibilities.