X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fresources%2FBundle.java;h=0c57bf992b495d8777b40753e850f9b827e47c39;hb=d46b7b96f94e88a776bcd2dfd756549ffb300cc9;hp=68c236fa108e7f54d842775d408607f7e2a7551c;hpb=d5026c096121da14c20d69893520594a36d088bb;p=fanfix.git diff --git a/src/be/nikiroo/utils/resources/Bundle.java b/src/be/nikiroo/utils/resources/Bundle.java index 68c236f..0c57bf9 100644 --- a/src/be/nikiroo/utils/resources/Bundle.java +++ b/src/be/nikiroo/utils/resources/Bundle.java @@ -92,7 +92,7 @@ public class Bundle> { /** * Check if the setting is set into this {@link Bundle}. * - * @param id + * @param name * the id of the setting to check * @param includeDefaultValue * TRUE to only return false when the setting is not set AND @@ -143,7 +143,8 @@ public class Bundle> { /** * Return the value associated to the given id as a {@link String}. *

- * If no value is associated, take the default one if any. + * If no value is associated (or if it is empty!), take the default one if + * any. * * @param id * the id of the value to get @@ -168,7 +169,6 @@ public class Bundle> { } } - //TODO: is it ok? need to jDoc? if (rep == null || rep.isEmpty()) { return def; } @@ -215,11 +215,7 @@ public class Bundle> { setString(id.name(), value); } else { List values = getList(id); - for (int i = values.size(); i < item; i++) { - values.add(null); - } - values.set(item, value); - setString(id.name(), BundleHelper.fromList(values)); + setString(id.name(), BundleHelper.fromList(values, value, item)); } } @@ -277,9 +273,6 @@ public class Bundle> { * the id of the value to get * @param suffix * the runtime suffix - * @param item - * the item number to get for an array of values, or -1 for - * non-arrays * @param def * the default value when it is not present in the config file * @param item @@ -577,6 +570,9 @@ public class Bundle> { * @param def * the default value when it is not present in the config file or * if it is not a char value + * @param item + * the item number to get for an array of values, or -1 for + * non-arrays * * @return the associated value */ @@ -645,6 +641,9 @@ public class Bundle> { * * @param id * the id of the value to get + * @param def + * the default value when it is not present in the config file or + * if it is not a char value * * @return the associated value */ @@ -667,6 +666,12 @@ public class Bundle> { * * @param id * the id of the value to get + * @param def + * the default value when it is not present in the config file or + * if it is not a char value + * @param item + * the item number to get for an array of values, or -1 for + * non-arrays * * @return the associated value */ @@ -733,6 +738,9 @@ public class Bundle> { * * @param id * the id of the value to get + * @param def + * the default value when it is not present in the config file or + * if it is not a char value * * @return the associated list, empty if the value is empty, NULL if it is * not found or cannot be parsed as a list @@ -754,6 +762,12 @@ public class Bundle> { * * @param id * the id of the value to get + * @param def + * the default value when it is not present in the config file or + * if it is not a char value + * @param item + * the item number to get for an array of values, or -1 for + * non-arrays * * @return the associated list, empty if the value is empty, NULL if it is * not found or cannot be parsed as a list @@ -1167,7 +1181,7 @@ public class Bundle> { } /** - * Reset the backing map to the content of the given bundle, or with default + * Reset the backing map to the content of the given bundle, or with NULL * values if bundle is NULL. * * @param bundle @@ -1185,7 +1199,7 @@ public class Bundle> { if (bundle != null) { value = bundle.getString(id.name()); } else { - value = meta.def(); + value = null; } this.map.put(id.name(), value == null ? null : value.trim());