I have a Java application that uses the Country class. Business logic connects every country in the world:
- Iso code.
- Telephone Phone Code
- A list of TZ database time zone identifiers suitable for this country.
Usually this data is ideal for a database. However, given the fact that this data is quite stable (of course, it changes from time to time, but it is usually not used to create / update / delete operations in these records). I was thinking about putting information into a list, like this:
public enum Country
{
US(1,new String[]{"America\New York","America\California",...}),
...
NL(31, new String[]{"Europe\Amsterdam"});
...
public Country(int telephoneCode, String[] timezoneIds)
{
...
}
}
Possible benefits of this approach:
- Data is directly accessible from Java source code, so there is no delay when querying the database.
- - ( , JDBC)
:
( № 3), .
Locale java, , java-. , . . ?