Fills a String formatted in a special way with values from Settings. String can contain (fully qualified) setting names surrounded by delimiters (see #FILL_DELIMITER). Values for those settings are retrieved and filled in the place of place holders. @param input The input string that may con
(String input)
| 850 | * @throws SettingsError if such settings were not found |
| 851 | */ |
| 852 | public String valueFillString(String input) { |
| 853 | if (!input.contains(FILL_DELIMITER)) { |
| 854 | return input; // nothing to fill |
| 855 | } |
| 856 | |
| 857 | Settings s = new Settings(); // don't use any namespace |
| 858 | String result = ""; |
| 859 | Scanner scan = new Scanner(input); |
| 860 | scan.useDelimiter(FILL_DELIMITER); |
| 861 | |
| 862 | if (input.startsWith(FILL_DELIMITER)) { |
| 863 | result += s.getSetting(scan.next()); |
| 864 | } |
| 865 | |
| 866 | while(scan.hasNext()) { |
| 867 | result += scan.next(); |
| 868 | if (!scan.hasNext()) { |
| 869 | break; |
| 870 | } |
| 871 | result += s.getSetting(scan.next()); |
| 872 | } |
| 873 | |
| 874 | return result; |
| 875 | } |
| 876 | |
| 877 | /** |
| 878 | * Returns a String representation of the stored settings |