RomanIakovlev / timeshape

Java library to find timezone based on geo coordinates
MIT License
160 stars 35 forks source link

Improve configurability of TimeZoneEngine class #59

Closed RomanIakovlev closed 1 year ago

RomanIakovlev commented 4 years ago

Currently the net.iakovlev.timeshape.TimeZoneEngine class is initialized using a bunch of overrides of initialize methods. This was fine in the beginning, but now there are already 5 overrides and more is needed (including but not limiting the #58). It's clearly time to introduce a different approach.

My current preference is to use some sort of TimeZoneEngineConfig class for this. This class will have all the configuration parameters exposed as getters. To configure an instance of this class, the Builder pattern will be used, since this approach seems to be sort of standard in the industry (see e.g. AWS and Google Cloud Java SDKs, or the Protobuf, it's really popular). The user of Timeshape will create and configure an instance of TimeZoneEngineConfig and pass it to the TimeZoneEngine.initialize method.

This will require another override of initialize method, but it will be the final one. I'll keep all the current initialize methods for backward compatibility.

If you have any suggestions or comments on this, please comment on this issue.

RomanIakovlev commented 1 year ago

Closing due to lack of activity.