+ return getString(id, null);
+ }
+
+ /**
+ * Return the value associated to the given id as a {@link String}.
+ * <p>
+ * If no value is associated, take the default one if any.
+ *
+ * @param id
+ * the id of the value to get
+ * @param def
+ * the default value when it is not present in the config file
+ *
+ * @return the associated value, or NULL if not found (not present in the
+ * resource file)
+ */
+ public String getString(E id, String def) {
+ return getString(id, def, -1);
+ }
+
+ /**
+ * Return the value associated to the given id as a {@link String}.
+ * <p>
+ * 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
+ * @param def
+ * the default value when it is not present in the config file
+ * @param item
+ * the item number to get for an array of values, or -1 for
+ * non-arrays
+ *
+ * @return the associated value, or NULL if not found (not present in the
+ * resource file)
+ */
+ public String getString(E id, String def, int item) {
+ String rep = getString(id.name(), null);
+ if (rep == null) {
+ try {
+ Meta meta = type.getDeclaredField(id.name()).getAnnotation(
+ Meta.class);
+ rep = meta.def();
+ } catch (NoSuchFieldException e) {
+ } catch (SecurityException e) {
+ }
+ }
+
+ if (rep == null || rep.isEmpty()) {
+ return def;
+ }
+
+ if (item >= 0) {
+ List<String> values = BundleHelper.parseList(rep, item);
+ if (values != null && item < values.size()) {
+ return values.get(item);
+ }
+
+ return null;
+ }
+
+ return rep;