TestRoots / watchdog

IntelliJ & Eclipse plugin for monitoring how Java applications are developed and tested
http://www.testroots.org
Other
19 stars 10 forks source link

Change preferences API from String-based to Project-based #299

Open TimvdLippe opened 6 years ago

TimvdLippe commented 6 years ago

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.

Inventitech commented 6 years ago

Sounds good. AFAIR, again, the reason for the current implementation are the datatypes the Eclipse persister API supports by default.