Class ProjectResourceMessageSource
java.lang.Object
org.springframework.context.support.MessageSourceSupport
org.springframework.context.support.AbstractMessageSource
org.springframework.context.support.AbstractResourceBasedMessageSource
org.springframework.context.support.ReloadableResourceBundleMessageSource
ru.cg.webbpm.studio.core.api.utils.ProjectResourceMessageSource
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.HierarchicalMessageSource
,org.springframework.context.MessageSource
,org.springframework.context.ResourceLoaderAware
public class ProjectResourceMessageSource
extends org.springframework.context.support.ReloadableResourceBundleMessageSource
Message source for project resource bundles. Treats empty properties as null.
Returns message as
Optional
instead of throwing error if message is not found.
If message is not found in system locale falls back to english locale. Fallback works only with getMessage(String, Object...)
,
all other methods are final and cannot be overridden.
Also fixes bug with file based resources on windows.- Author:
- Tim Urmancheev
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.context.support.ReloadableResourceBundleMessageSource
org.springframework.context.support.ReloadableResourceBundleMessageSource.PropertiesHolder
-
Field Summary
Fields inherited from class org.springframework.context.support.MessageSourceSupport
logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetMessage
(String code, Object... args) getMessages
(Locale locale) void
setBasenames
(String... basenames) void
setFileBaseName
(Path basename) tryGetMessage
(String code, Object[] args, Locale locale) Methods inherited from class org.springframework.context.support.ReloadableResourceBundleMessageSource
calculateAllFilenames, calculateFilenamesForLocale, clearCache, clearCacheIncludingAncestors, getMergedProperties, getProperties, loadProperties, newProperties, refreshProperties, resolveCode, resolveCodeWithoutArguments, setConcurrentRefresh, setFileEncodings, setPropertiesPersister, setResourceLoader, toString
Methods inherited from class org.springframework.context.support.AbstractResourceBasedMessageSource
addBasenames, getBasenameSet, getCacheMillis, getDefaultEncoding, getDefaultLocale, isFallbackToSystemLocale, setBasename, setCacheMillis, setCacheSeconds, setDefaultEncoding, setDefaultLocale, setFallbackToSystemLocale
Methods inherited from class org.springframework.context.support.AbstractMessageSource
getCommonMessages, getDefaultMessage, getDefaultMessage, getMessage, getMessage, getMessage, getMessageFromParent, getMessageInternal, getParentMessageSource, isUseCodeAsDefaultMessage, resolveArguments, setCommonMessages, setParentMessageSource, setUseCodeAsDefaultMessage
Methods inherited from class org.springframework.context.support.MessageSourceSupport
createMessageFormat, formatMessage, isAlwaysUseMessageFormat, renderDefaultMessage, setAlwaysUseMessageFormat
-
Constructor Details
-
ProjectResourceMessageSource
public ProjectResourceMessageSource()
-
-
Method Details
-
setFileBaseName
-
setBasenames
- Overrides:
setBasenames
in classorg.springframework.context.support.AbstractResourceBasedMessageSource
-
getMessage
-
tryGetMessage
-
getMessages
-