Class BLCMessageUtils
java.lang.Object
org.broadleafcommerce.common.util.BLCMessageUtils
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
@Service("blBLCMessageUtils")
public class BLCMessageUtils
extends Object
implements org.springframework.context.ApplicationContextAware
Convenience class to faciliate getting internationalized messages.
Note that this class is scanned as a bean to pick up the applicationContext, but the methods
this class provides should be invoked statically.
- Author:
- Andre Azzolini (apazzolini)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static org.springframework.context.ApplicationContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetMessage(String code) Returns the message requested by the code with no arguments and the currently set Java Locale on theBroadleafRequestContextas returned byBroadleafRequestContext.getJavaLocale()static StringgetMessage(String code, Object... args) Returns the message requested by the code with the specified arguments and the currently set Java Locale on theBroadleafRequestContextas returned byBroadleafRequestContext.getJavaLocale()protected static org.springframework.context.MessageSourcevoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)
-
Field Details
-
applicationContext
protected static org.springframework.context.ApplicationContext applicationContext
-
-
Constructor Details
-
BLCMessageUtils
public BLCMessageUtils()
-
-
Method Details
-
getMessage
Returns the message requested by the code with no arguments and the currently set Java Locale on theBroadleafRequestContextas returned byBroadleafRequestContext.getJavaLocale()- Parameters:
code-- Returns:
- the message
-
getMessage
Returns the message requested by the code with the specified arguments and the currently set Java Locale on theBroadleafRequestContextas returned byBroadleafRequestContext.getJavaLocale()- Parameters:
code-- Returns:
- the message
-
getMessageSource
protected static org.springframework.context.MessageSource getMessageSource()- Returns:
- the "messageSource" bean from the application context
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-