/** * Initialize the Properties instance based on all the PropertiesSources that have been registered. */ protected void initializeProperties() { properties = new Properties(); for (PropertiesSource source : propertiesSources) { Properties p = source.getProperties(); if (p != null) { properties.putAll(p); } } }
/** * Populate the customTokens map in this class with the properties from the given properties source. * @param propertiesSource * @param prefix optional; if set, then each token key that is added has the prefix prepended to it * @param suffix optional; if set, then each token key that is added has the suffix appended to it */ public void populateCustomTokens(PropertiesSource propertiesSource, String prefix, String suffix) { Properties props = propertiesSource.getProperties(); if (props != null) { if (customTokens == null) { customTokens = new HashMap<>(); } for (Object key : props.keySet()) { String skey = (String)key; String value = props.getProperty(skey); if (value != null) { String token = skey; if (prefix != null) { token = prefix + token; } if (suffix != null) { token = token + suffix; } customTokens.put(token, value); } } } }