org.broadleafcommerce.common.util
Class BLCMessageUtils

java.lang.Object
  extended by org.broadleafcommerce.common.util.BLCMessageUtils
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Service(value="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
protected static org.springframework.context.ApplicationContext applicationContext
           
 
Constructor Summary
BLCMessageUtils()
           
 
Method Summary
static String getMessage(String code)
          Returns the message requested by the code with no arguments and the currently set Java Locale on the BroadleafRequestContext as returned by BroadleafRequestContext.getJavaLocale()
static String getMessage(String code, Object[] args)
          Returns the message requested by the code with the specified arguments and the currently set Java Locale on the BroadleafRequestContext as returned by BroadleafRequestContext.getJavaLocale()
protected static org.springframework.context.MessageSource getMessageSource()
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

applicationContext

protected static org.springframework.context.ApplicationContext applicationContext
Constructor Detail

BLCMessageUtils

public BLCMessageUtils()
Method Detail

getMessage

public static String getMessage(String code)
Returns the message requested by the code with no arguments and the currently set Java Locale on the BroadleafRequestContext as returned by BroadleafRequestContext.getJavaLocale()

Parameters:
code -
Returns:
the message

getMessage

public static String getMessage(String code,
                                Object[] args)
Returns the message requested by the code with the specified arguments and the currently set Java Locale on the BroadleafRequestContext as returned by BroadleafRequestContext.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:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException


Copyright © 2013. All Rights Reserved.