本文整理了Java中org.springframework.context.support.ResourceBundleMessageSource.getStringOrNull
方法的一些代码示例,展示了ResourceBundleMessageSource.getStringOrNull
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceBundleMessageSource.getStringOrNull
方法的具体详情如下:
包路径:org.springframework.context.support.ResourceBundleMessageSource
类名称:ResourceBundleMessageSource
方法名:getStringOrNull
[英]Efficiently retrieve the String value for the specified key, or return null if not found.
As of 4.2, the default implementation checks containsKeybefore it attempts to call getString (which would require catching MissingResourceException for key not found).
Can be overridden in subclasses.
[中]高效地检索指定键的字符串值,如果找不到,则返回null。
从4.2开始,默认实现会在尝试调用getString之前检查ContainesKeyBefore(这需要捕获未找到密钥的MissingResourceException)。
可以在子类中重写。
代码示例来源:origin: spring-projects/spring-framework
String msg = getStringOrNull(bundle, code);
if (msg != null) {
if (codeMap == null) {
代码示例来源:origin: spring-projects/spring-framework
/**
* Resolves the given message code as key in the registered resource bundles,
* returning the value found in the bundle as-is (without MessageFormat parsing).
*/
@Override
protected String resolveCodeWithoutArguments(String code, Locale locale) {
Set<String> basenames = getBasenameSet();
for (String basename : basenames) {
ResourceBundle bundle = getResourceBundle(basename, locale);
if (bundle != null) {
String result = getStringOrNull(bundle, code);
if (result != null) {
return result;
}
}
}
return null;
}
代码示例来源:origin: org.springframework/spring-context
String msg = getStringOrNull(bundle, code);
if (msg != null) {
if (codeMap == null) {
代码示例来源:origin: org.springframework/spring-context
/**
* Resolves the given message code as key in the registered resource bundles,
* returning the value found in the bundle as-is (without MessageFormat parsing).
*/
@Override
protected String resolveCodeWithoutArguments(String code, Locale locale) {
Set<String> basenames = getBasenameSet();
for (String basename : basenames) {
ResourceBundle bundle = getResourceBundle(basename, locale);
if (bundle != null) {
String result = getStringOrNull(bundle, code);
if (result != null) {
return result;
}
}
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!