What is the best way to decide whether to use ListResourceBundle or PropertyResource Bundle?

swarraj kulkarni

The "best" choice depends on the application's requirements. Since the ListResourceBundle is based on a java class, for every modification a recompile is required which can be cumbersome.
But a ListResourceBundle has no limitation on the type of information it can hold. It can have objects as part of the information, such as Array of Strings or integers. Further, for system infrastructure messages, where deployment time change is not necessary, we can prefer ListResourceBundle.

A PropertyResourceBundle is backed up by a .properties file where the key=value format of information is loaded at runtime into the system. In a deployment where the environment related parameters need to be flexible, this type helps because no recompilation is necessary. The limitation is that a properties file can only contain text strings.

Use PropertyResourceBundle for deployment environment specific information, messages or platform variables which can be easily modified by the deployment engineer or end user and which are not very critical.

Use ListResourceBundle when you are providing the system messages/information and where you require complex objects as part of the i18n support.

Vikram Koneri adds:

When the information returned needs to be dynamically obtained, for example, from a database table, then ListResourceBundle is required.

Joe Sam Shirah adds:

Another consideration quasi-security related: Should the end user be allowed to change values going into the application or not? This depends on the application, but is always a possibility with a PropertyResourceBundle.

About | Sitemap | Contact