Package com.networknt.schema.i18n
Class ResourceBundleMessageSource
java.lang.Object
com.networknt.schema.i18n.ResourceBundleMessageSource
- All Implemented Interfaces:
MessageSource
MessageSource that retrieves messages from a ResourceBundle.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the message.protected MessageFormatgetMessageFormat(Locale locale, String message) protected StringgetMessageFromCache(Locale locale, String key) Gets the message from cache or the resource bundles.protected Map<Locale, ResourceBundle> getResourceBundle(String baseName) protected ResourceBundlegetResourceBundle(String baseName, Locale locale) protected StringresolveMessage(Locale locale, String key) Gets the message from the resource bundles.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.networknt.schema.i18n.MessageSource
getMessage, getMessage
-
Constructor Details
-
ResourceBundleMessageSource
-
-
Method Details
-
getMessage
public String getMessage(String key, Supplier<String> defaultMessage, Locale locale, Object... arguments) Description copied from interface:MessageSourceGets the message.- Specified by:
getMessagein interfaceMessageSource- Parameters:
key- to look up the messagedefaultMessage- the default messagelocale- the locale to usearguments- the message arguments- Returns:
- the message
-
getMessageFormat
-
getMessageFromCache
Gets the message from cache or the resource bundles. Returns an empty string if not found.- Parameters:
locale- the localekey- the message key- Returns:
- the message
-
resolveMessage
Gets the message from the resource bundles. Returns an empty string if not found.- Parameters:
locale- the localekey- the message key- Returns:
- the message
-
getResourceBundle
-
getResourceBundle
-