I tried to push the reasoning a bit further yesterday and observed that if there is a SubsetConfiguration shifting the parent keys to the left, we might imagine a SupersetConfiguration shifting the keys to the right by adding a prefix. Both classes could even be merged into a TranslatedConfiguration. But what use case could require the addition of a prefix to all the keys of a configuration ? I identified 2 use cases:

- ini files, a section is basically a configuration translated to the right by the section name.

- configuration "mounting" in a CompositeConfiguration, to mix heterogeneous configurations with identical keys into a unique configuration. For example, given 2 configurations:

mail.properties:
server=smtp.xyz.com

database.properties:
server=db.xyz.com

One would mount the configuration into a CompositeConfiguration to avoid conflicts:

composite.addConfiguration(new TranslatedConfiguration(mail, "mail"));
composite.addConfiguration(new TranslatedConfiguration(database, "database"));


composite.getString("mail.server");
composite.getString("database.server");


Emmanuel Bourg


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to