75 /**
76 * This method is to provide a customized ResourceBundle.Control to speed
77 * up the search of resources in JDK, with the bundle's package name check.
78 *
79 * @param bundleName bundle name to check
80 * @return the instance of resource bundle control if the bundle is JDK's,
81 * otherwise returns null.
82 */
83 public static CoreResourceBundleControl getRBControlInstance(String bundleName) {
84 if (bundleName.startsWith("com.sun.") ||
85 bundleName.startsWith("java.") ||
86 bundleName.startsWith("javax.") ||
87 bundleName.startsWith("sun.")) {
88 return resourceBundleControlInstance;
89 } else {
90 return null;
91 }
92 }
93
94 /**
95 * @returns a list of candidate locales to search from.
96 * @exception NullPointerException if baseName or locale is null.
97 */
98 @Override
99 public List<Locale> getCandidateLocales(String baseName, Locale locale) {
100 List<Locale> candidates = super.getCandidateLocales(baseName, locale);
101 candidates.removeAll(excludedJDKLocales);
102 return candidates;
103 }
104
105 /**
106 * @ returns TTL_DONT_CACHE so that ResourceBundle instance won't be cached.
107 * User of this CoreResourceBundleControl should probably maintain a hard reference
108 * to the ResourceBundle object themselves.
109 */
110 @Override
111 public long getTimeToLive(String baseName, Locale locale) {
112 return ResourceBundle.Control.TTL_DONT_CACHE;
113 }
114 }
|
75 /**
76 * This method is to provide a customized ResourceBundle.Control to speed
77 * up the search of resources in JDK, with the bundle's package name check.
78 *
79 * @param bundleName bundle name to check
80 * @return the instance of resource bundle control if the bundle is JDK's,
81 * otherwise returns null.
82 */
83 public static CoreResourceBundleControl getRBControlInstance(String bundleName) {
84 if (bundleName.startsWith("com.sun.") ||
85 bundleName.startsWith("java.") ||
86 bundleName.startsWith("javax.") ||
87 bundleName.startsWith("sun.")) {
88 return resourceBundleControlInstance;
89 } else {
90 return null;
91 }
92 }
93
94 /**
95 * @return a list of candidate locales to search from.
96 * @exception NullPointerException if baseName or locale is null.
97 */
98 @Override
99 public List<Locale> getCandidateLocales(String baseName, Locale locale) {
100 List<Locale> candidates = super.getCandidateLocales(baseName, locale);
101 candidates.removeAll(excludedJDKLocales);
102 return candidates;
103 }
104
105 /**
106 * @ returns TTL_DONT_CACHE so that ResourceBundle instance won't be cached.
107 * User of this CoreResourceBundleControl should probably maintain a hard reference
108 * to the ResourceBundle object themselves.
109 */
110 @Override
111 public long getTimeToLive(String baseName, Locale locale) {
112 return ResourceBundle.Control.TTL_DONT_CACHE;
113 }
114 }
|