Package net.solarnetwork.central.support
Class VersionedMessageDaoMessageSource
java.lang.Object
org.springframework.context.support.MessageSourceSupport
org.springframework.context.support.AbstractMessageSource
net.solarnetwork.central.support.VersionedMessageDaoMessageSource
- All Implemented Interfaces:
org.springframework.context.HierarchicalMessageSource,org.springframework.context.MessageSource
public class VersionedMessageDaoMessageSource
extends org.springframework.context.support.AbstractMessageSource
MessageSource implementation that uses a VersionedMessageDao
to load messages.- Since:
- 2.6
-
Field Summary
Fields inherited from class org.springframework.context.support.MessageSourceSupport
logger -
Constructor Summary
ConstructorsConstructorDescriptionVersionedMessageDaoMessageSource(VersionedMessageDao dao, String[] bundleNames, Instant version, javax.cache.Cache<String, VersionedMessageDao.VersionedMessages> cache) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionpropertiesForLocale(Locale locale) Get aPropertiesobject of all available messages for a given locale.protected MessageFormatresolveCode(String code, Locale locale) Methods inherited from class org.springframework.context.support.AbstractMessageSource
getCommonMessages, getDefaultMessage, getDefaultMessage, getMessage, getMessage, getMessage, getMessageFromParent, getMessageInternal, getParentMessageSource, isUseCodeAsDefaultMessage, resolveArguments, resolveCodeWithoutArguments, setCommonMessages, setParentMessageSource, setUseCodeAsDefaultMessageMethods inherited from class org.springframework.context.support.MessageSourceSupport
createMessageFormat, formatMessage, isAlwaysUseMessageFormat, renderDefaultMessage, setAlwaysUseMessageFormat
-
Constructor Details
-
VersionedMessageDaoMessageSource
public VersionedMessageDaoMessageSource(VersionedMessageDao dao, String[] bundleNames, Instant version, javax.cache.Cache<String, VersionedMessageDao.VersionedMessages> cache) Constructor.- Parameters:
dao- the DAO to usebundleNames- the bundle namesversion- the desired version; if null the system date will be usedcache- the optional cache- Throws:
IllegalArgumentException- ifdaoorbundleNamesare null
-
-
Method Details
-
resolveCode
- Specified by:
resolveCodein classorg.springframework.context.support.AbstractMessageSource
-
propertiesForLocale
Get aPropertiesobject of all available messages for a given locale.- Parameters:
locale- the locale of the messages to get- Returns:
- the properties or null if none available
-