@Test public void testOptional() throws Exception { assertEquals("Should get 'localhost'", PropertyUtil.getOptional("redisHostname"), "localhost"); assertEquals("Should get '10'", PropertyUtil.getOptional("workerCount"), "10"); assertEquals("Should get <null>", PropertyUtil.getOptional("non-existing-property"), null); }
public static String getOptional(final String propertyName) { return get(new Locale(getDefaultLanguage()), propertyName, null); }
PropertyUtil { public static String getOptional(final String propertyName) { return get(new Locale(getDefaultLanguage()), propertyName, null); } }
PropertyUtil { public static String getOptional(final String propertyName) { return get(new Locale(getDefaultLanguage()), propertyName, null); }  }
PropertyUtil { public static String getOptional(final String propertyName) { return get(new Locale(getDefaultLanguage()), propertyName, null); }  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 getOptional(final String propertyName) { return get(new Locale(getDefaultLanguage()), propertyName, null); }  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();  }