/** * @param key the key for the desired parameter * @return an array of Boolean objects associated with the given key. */ public Boolean[] getBooleans(String key) { Object[] array = getValues(key); if (array == null || Boolean.class.isAssignableFrom(array.getClass().getComponentType())) { return (Boolean[])array; } Boolean[] ret = new Boolean[array.length]; for (int i = 0; i < array.length; ++i) { ret[i] = ConversionUtils.toBoolean(array[i]); } return ret; }
/** * @param key the key for the desired parameter * @return an array of Locale objects associated with the given key, * or <code>null</code> if Locales are not associated with it. */ public Locale[] getLocales(String key) { Object[] array = getValues(key); if (array == null || Locale.class.isAssignableFrom(array.getClass().getComponentType())) { return (Locale[])array; } Locale[] ret = new Locale[array.length]; for (int i = 0; i < array.length; ++i) { ret[i] = ConversionUtils.toLocale(String.valueOf(array[i])); } return ret; }
/** * @param key the key for the desired parameter * @return an array of String objects containing all of the values * associated with the given key, or <code>null</code> * if the no values are associated with the given key */ public String[] getStrings(String key) { Object[] array = getValues(key); if (array == null || String.class.isAssignableFrom(array.getClass().getComponentType())) { return (String[])array; } String[] ret = new String[array.length]; for (int i = 0; i < array.length; ++i) { ret[i] = ConversionUtils.toString(array[i]); } return ret; }
/** * @param key the key for the desired parameter * @return an array of Number objects associated with the given key, * or <code>null</code> if Numbers are not associated with it. */ public Number[] getNumbers(String key) { Object[] array = getValues(key); if (array == null || Number.class.isAssignableFrom(array.getClass().getComponentType())) { return (Number[])array; } Number[] ret = new Number[array.length]; for (int i = 0; i < array.length; ++i) { ret[i] = ConversionUtils.toNumber(array[i], getFormat(), getLocale()); } return ret; }
/** * @param key the key for the desired parameter * @return an array of double values associated with the given key, * or <code>null</code> if numbers are not associated with it. */ public double[] getDoubles(String key) { Object[] array = getValues(key); if (array == null) { return null; } double[] ret = new double[array.length]; for (int i = 0; i < array.length; ++i) { ret[i] = ConversionUtils.toNumber(array[i], getFormat(), getLocale()).doubleValue(); } return ret; }
/** * @param key the key for the desired parameter * @return an array of int values associated with the given key, * or <code>null</code> if numbers are not associated with it. */ public int[] getInts(String key) { Object[] array = getValues(key); if (array == null) { return null; } int[] ret = new int[array.length]; for (int i = 0; i < array.length; ++i) { ret[i] = ConversionUtils.toNumber(array[i], getFormat(), getLocale()).intValue(); } return ret; }