doc / ch.tutteli.atrium.reporting.translating / PropertiesBasedTranslationSupplier / getOrLoadProperties

getOrLoadProperties

protected fun getOrLoadProperties(key: T, fileName: String, keyCreator: (String) -> String): Map<String, String> (source)

Gets the cached Properties content as Map for the given key or loads the properties file with the given fileName and creates a map out of it using the given keyCreator function to create the keys of the map, based on a key of a property.

Parameters

key - The key which identifies the Properties

fileName - The fileName of the properties file without file extension, including the package in which it resides as absolute path (no '../' are allowed). In case it does not start with '/' (which would be a relative path), then a '/' is prepended. Hence it is always searched with an absolute path -- which is the same behaviour as for a properties based ResourceBundle.

keyCreator - The function used to create keys of the resulting Map (in case the properties file needs to be loaded). It is called passing in a key of a property of the properties file.

Return
A Map containing the resulting keys (based on the Properties, see keyCreator) with its translations.