/** * Get a resource given bundle name and key * @param <T> type of the resource * @param bundleName name of the resource bundle * @param key to lookup the resource * @param suffix for the key to lookup * @param defaultValue of the resource * @return the resource or the defaultValue * @throws ClassCastException if the resource found doesn't match T */ @SuppressWarnings("unchecked") public static synchronized <T> T getValue(String bundleName, String key, String suffix, T defaultValue) { T value; try { ResourceBundle bundle = getBundle(bundleName); value = (T) bundle.getObject(getLookupKey(key, suffix)); } catch (Exception e) { return defaultValue; } return value; }
/** * Get a resource given bundle name and key * @param <T> type of the resource * @param bundleName name of the resource bundle * @param key to lookup the resource * @param suffix for the key to lookup * @param defaultValue of the resource * @return the resource or the defaultValue * @throws ClassCastException if the resource found doesn't match T */ @SuppressWarnings("unchecked") public static synchronized <T> T getValue(String bundleName, String key, String suffix, T defaultValue) { T value; try { ResourceBundle bundle = getBundle(bundleName); value = (T) bundle.getObject(getLookupKey(key, suffix)); } catch (Exception e) { return defaultValue; } return value; }
/** * Get a resource given bundle name and key * @param <T> type of the resource * @param bundleName name of the resource bundle * @param key to lookup the resource * @param suffix for the key to lookup * @param defaultValue of the resource * @return the resource or the defaultValue * @throws ClassCastException if the resource found doesn't match T */ @SuppressWarnings("unchecked") public static synchronized <T> T getValue(String bundleName, String key, String suffix, T defaultValue) { T value; try { ResourceBundle bundle = getBundle(bundleName); value = (T) bundle.getObject(getLookupKey(key, suffix)); } catch (Exception e) { return defaultValue; } return value; }
/** * Get a resource given bundle name and key * @param <T> type of the resource * @param bundleName name of the resource bundle * @param key to lookup the resource * @param suffix for the key to lookup * @param defaultValue of the resource * @return the resource or the defaultValue * @throws ClassCastException if the resource found doesn't match T */ @SuppressWarnings("unchecked") public static synchronized <T> T getValue(String bundleName, String key, String suffix, T defaultValue) { T value; try { ResourceBundle bundle = getBundle(bundleName); value = (T) bundle.getObject(getLookupKey(key, suffix)); } catch (Exception e) { return defaultValue; } return value; }