+ /**
+ * The allowed list of values that a {@link Format#FIXED_LIST} item is
+ * allowed to be, or a list of suggestions for {@link Format#COMBO_LIST}
+ * items. Also works for {@link Format#LOCALE}.
+ * <p>
+ * Will always allow an empty string in addition to the rest.
+ *
+ * @return the list of values
+ */
+ public String[] getAllowedValues() {
+ String[] list = meta.list();
+
+ String[] withEmpty = new String[list.length + 1];
+ withEmpty[0] = "";
+ for (int i = 0; i < list.length; i++) {
+ withEmpty[i + 1] = list[i];
+ }
+
+ return withEmpty;
+ }
+
+ /**
+ * Return all the languages known by the program for this bundle.
+ * <p>
+ * This only works for {@link TransBundle}, and will return an empty list if
+ * this is not a {@link TransBundle}.
+ *
+ * @return the known language codes
+ */
+ public List<String> getKnownLanguages() {
+ if (bundle instanceof TransBundle) {
+ return ((TransBundle<E>) bundle).getKnownLanguages();
+ }
+
+ return new ArrayList<String>();
+ }
+
+ /**
+ * This item is a comma-separated list of values instead of a single value.
+ * <p>
+ * The list items are separated by a comma, each surrounded by
+ * double-quotes, with backslashes and double-quotes escaped by a backslash.
+ * <p>
+ * Example: <tt>"un", "deux"</tt>
+ *
+ * @return TRUE if it is
+ */
+ public boolean isArray() {
+ return meta.array();
+ }
+
+ /**
+ * A manual flag to specify if the data has been changed or not, which can
+ * be used by {@link MetaInfo#save(boolean)}.
+ *
+ * @return TRUE if it is dirty (if it has changed)
+ */
+ public boolean isDirty() {
+ return dirty;
+ }
+
+ /**
+ * A manual flag to specify that the data has been changed, which can be
+ * used by {@link MetaInfo#save(boolean)}.
+ */
+ public void setDirty() {
+ this.dirty = true;
+ }
+
+ /**
+ * The number of items in this item if it {@link MetaInfo#isArray()}, or -1
+ * if not.
+ *
+ * @param useDefaultIfEmpty
+ * check the size of the default list instead if the list is
+ * empty
+ *
+ * @return -1 or the number of items
+ */
+ public int getListSize(boolean useDefaultIfEmpty) {
+ if (!isArray()) {
+ return -1;
+ }
+
+ return BundleHelper.getListSize(getString(-1, useDefaultIfEmpty));
+ }
+
+ /**
+ * This item is only used as a group, not as an option.
+ * <p>
+ * For instance, you could have LANGUAGE_CODE as a group for which you won't
+ * use the value in the program, and LANGUAGE_CODE_FR, LANGUAGE_CODE_EN
+ * inside for which the value must be set.
+ *
+ * @return TRUE if it is a group
+ */
+ public boolean isGroup() {
+ return meta.group();
+ }
+