@Test public void testCommaSeparatedProperty() throws Exception { String[] values1 = PropertyUtil.getCommaSeparatedList("commaseparatedNoSpaces"); String[] values2 = PropertyUtil.getCommaSeparatedList("commaseparatedWithSpaces"); for(int i = 0 ; i < values1.length; ++i) { assertEquals("Values in both arrays should match", values1[i], values2[i]); } String[] values3 = PropertyUtil.getCommaSeparatedList("non-existing-property"); assertEquals("Non-existing list should be zero length", values3.length, 0); }
public static String[] getCommaSeparatedList(final String propertyName) { final String propertiesList = get(new Locale(getDefaultLanguage()), propertyName, null); if (propertiesList == null || propertiesList.isEmpty()) { return new String[0]; } return propertiesList.split("\\s*,\\s*"); }
PropertyUtil { public static String[] getCommaSeparatedList(final String propertyName) { final String propertiesList = get(new Locale(getDefaultLanguage()), propertyName, null); if (propertiesList == null || propertiesList.isEmpty()) { return new String[0]; } return propertiesList.split("\\s*,\\s*"); } }
PropertyUtil { public static String[] getCommaSeparatedList(final String propertyName) { final String propertiesList = get(new Locale(getDefaultLanguage()), propertyName, null); if (propertiesList == null || propertiesList.isEmpty()) { return new String[0]; } return propertiesList.split("\\s*,\\s*"); }  }
PropertyUtil { public static String[] getCommaSeparatedList(final String propertyName) { final String propertiesList = get(new Locale(getDefaultLanguage()), propertyName, null); if (propertiesList == null || propertiesList.isEmpty()) { return new String[0]; } return propertiesList.split("\\s*,\\s*"); }  static String[] getSupportedLocales(); static String getDefaultLocale(); static String[] getSupportedLanguages(); static String getDefaultLanguage(); static void setLogger(Logger logger); static void loadProperties(final String propertiesFile); static void loadProperties(final String propertiesFile, final boolean overwrite); static void clearProperties(); static String getNecessary(final String propertyName); static String getNecessary(final String propertyName, final String detailMessage); static String[] getCommaSeparatedList(final String propertyName); static Map<String, String> getMap(final String propertyName); static String getOptionalNonLocalized(final String propertyName); static String getOptional(final String propertyName); static String get(final String propertyName); static String get(final String propertyName, final String defaultValue); static int getOptional(final String propertyName, final int defaultValue); static double getOptional(final String propertyName, final double defaultValue); static boolean getOptional(final String propertyName, final boolean defaultValue); static String get(final Locale locale, final String propertyName); static String get(final Locale locale, final String propertyName, final String defaultValue); static Object getLocalizableProperty(final String key); static String getWithOptionalModifier(final String key, String... modifiers); static Object getLocalizableProperty(final String key, final String defaultValue); static List<String> getPropertyNamesStartingWith(final String prefix); static List<String> getMatchingPropertyNames(final String regex); static void addProperties(final Properties props, final boolean overwrite); static void addProperties(final Properties props); static void addProperty(final String key, final String value); static void addProperty(final String key, final String value, final boolean overwrite); static void addProperty(final String key, final String value, final Locale locale); static Properties getProperties(); }
PropertyUtil { public static String[] getCommaSeparatedList(final String propertyName) { final String propertiesList = get(new Locale(getDefaultLanguage()), propertyName, null); if (propertiesList == null || propertiesList.isEmpty()) { return new String[0]; } return propertiesList.split("\\s*,\\s*"); }  static String[] getSupportedLocales(); static String getDefaultLocale(); static String[] getSupportedLanguages(); static String getDefaultLanguage(); static void setLogger(Logger logger); static void loadProperties(final String propertiesFile); static void loadProperties(final String propertiesFile, final boolean overwrite); static void clearProperties(); static String getNecessary(final String propertyName); static String getNecessary(final String propertyName, final String detailMessage); static String[] getCommaSeparatedList(final String propertyName); static Map<String, String> getMap(final String propertyName); static String getOptionalNonLocalized(final String propertyName); static String getOptional(final String propertyName); static String get(final String propertyName); static String get(final String propertyName, final String defaultValue); static int getOptional(final String propertyName, final int defaultValue); static double getOptional(final String propertyName, final double defaultValue); static boolean getOptional(final String propertyName, final boolean defaultValue); static String get(final Locale locale, final String propertyName); static String get(final Locale locale, final String propertyName, final String defaultValue); static Object getLocalizableProperty(final String key); static String getWithOptionalModifier(final String key, String... modifiers); static Object getLocalizableProperty(final String key, final String defaultValue); static List<String> getPropertyNamesStartingWith(final String prefix); static List<String> getMatchingPropertyNames(final String regex); static void addProperties(final Properties props, final boolean overwrite); static void addProperties(final Properties props); static void addProperty(final String key, final String value); static void addProperty(final String key, final String value, final boolean overwrite); static void addProperty(final String key, final String value, final Locale locale); static Properties getProperties();  }