/** Returns the String array value found in the resource bundle for the specified key, or the specified default value if not found. * Multi-line strings can be specified in the resource bundle with {@code key.0}, {@code key.1}, {@code key.2}, etc. * @param key unqualified resource bundle key. This method will first try to find a value by qualifying the key with the command's fully qualified name, * and if not found, it will try with the unqualified key. * @param defaultValues value to return if the resource bundle is null or empty, or if no value was found by the qualified or unqualified key * @return the String array value found in the resource bundle for the specified key, or the specified default value */ public String[] getStringArray(String key, String[] defaultValues) { if (isEmpty()) { return defaultValues; } String cmd = spec.qualifiedName("."); List<String> result = addAllWithPrefix(rb, cmd + "." + key, keys, new ArrayList<String>()); if (!result.isEmpty()) { return result.toArray(new String[0]); } addAllWithPrefix(rb, key, keys, result); return result.isEmpty() ? defaultValues : result.toArray(new String[0]); } private static List<String> addAllWithPrefix(ResourceBundle rb, String key, Set<String> keys, List<String> result) {
/** Returns the String array value found in the resource bundle for the specified key, or the specified default value if not found. * Multi-line strings can be specified in the resource bundle with {@code key.0}, {@code key.1}, {@code key.2}, etc. * @param key unqualified resource bundle key. This method will first try to find a value by qualifying the key with the command's fully qualified name, * and if not found, it will try with the unqualified key. * @param defaultValues value to return if the resource bundle is null or empty, or if no value was found by the qualified or unqualified key * @return the String array value found in the resource bundle for the specified key, or the specified default value */ public String[] getStringArray(String key, String[] defaultValues) { if (isEmpty()) { return defaultValues; } String cmd = spec.qualifiedName("."); List<String> result = addAllWithPrefix(rb, cmd + "." + key, keys, new ArrayList<String>()); if (!result.isEmpty()) { return result.toArray(new String[0]); } addAllWithPrefix(rb, key, keys, result); return result.isEmpty() ? defaultValues : result.toArray(new String[0]); } private static List<String> addAllWithPrefix(ResourceBundle rb, String key, Set<String> keys, List<String> result) {