com.liferay.faces.util.i18n
Class I18nBundleBase

java.lang.Object
  extended by com.liferay.faces.util.i18n.I18nWrapper
      extended by com.liferay.faces.util.i18n.I18nBundleBase
All Implemented Interfaces:
I18n, Serializable, javax.faces.FacesWrapper<I18n>

public abstract class I18nBundleBase
extends I18nWrapper
implements Serializable

This is an abstract class that provides a convenient base implementation for introducing an internationalized ResourceBundle into the I18n delegation chain. For the sake of performance, lookups into the ResourceBundle are cached by this class in a synchronized map.

Author:
Neil Griffin
See Also:
Serialized Form

Constructor Summary
I18nBundleBase(I18n i18n)
           
 
Method Summary
abstract  String getBundleKey()
           
 javax.faces.application.FacesMessage getFacesMessage(javax.faces.context.FacesContext facesContext, Locale locale, javax.faces.application.FacesMessage.Severity severity, String messageId)
          See I18n.getFacesMessage(FacesContext, Locale, FacesMessage.Severity, String)
 javax.faces.application.FacesMessage getFacesMessage(javax.faces.context.FacesContext facesContext, Locale locale, javax.faces.application.FacesMessage.Severity severity, String messageId, Object... arguments)
          See I18n.getFacesMessage(FacesContext, Locale, FacesMessage.Severity, String, Object...)
 String getMessage(javax.faces.context.FacesContext facesContext, Locale locale, String messageId)
          See I18n.getMessage(FacesContext, Locale, String)
 String getMessage(javax.faces.context.FacesContext facesContext, Locale locale, String messageId, Object... arguments)
          See I18n.getMessage(FacesContext, Locale, String, Object...)
 I18n getWrapped()
           
protected  Cache<String,String> newConcurrentMessageCache(javax.faces.context.ExternalContext externalContext)
          Returns a new message cache to be used by I18nBundleBase.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

I18nBundleBase

public I18nBundleBase(I18n i18n)
Method Detail

getBundleKey

public abstract String getBundleKey()

getFacesMessage

public javax.faces.application.FacesMessage getFacesMessage(javax.faces.context.FacesContext facesContext,
                                                            Locale locale,
                                                            javax.faces.application.FacesMessage.Severity severity,
                                                            String messageId)
Description copied from class: I18nWrapper
See I18n.getFacesMessage(FacesContext, Locale, FacesMessage.Severity, String)

Specified by:
getFacesMessage in interface I18n
Overrides:
getFacesMessage in class I18nWrapper
Parameters:
facesContext - The current faces context.
locale - The locale of the message.
severity - The severity of the message.
messageId - The id of the message.

getFacesMessage

public javax.faces.application.FacesMessage getFacesMessage(javax.faces.context.FacesContext facesContext,
                                                            Locale locale,
                                                            javax.faces.application.FacesMessage.Severity severity,
                                                            String messageId,
                                                            Object... arguments)
Description copied from class: I18nWrapper
See I18n.getFacesMessage(FacesContext, Locale, FacesMessage.Severity, String, Object...)

Specified by:
getFacesMessage in interface I18n
Overrides:
getFacesMessage in class I18nWrapper
Parameters:
facesContext - The current faces context.
locale - The locale of the message.
severity - The severity of the message.
messageId - The id of the message.
arguments - The values that are to be inserted according to the MessageFormat pattern.

getMessage

public String getMessage(javax.faces.context.FacesContext facesContext,
                         Locale locale,
                         String messageId)
Description copied from class: I18nWrapper
See I18n.getMessage(FacesContext, Locale, String)

Specified by:
getMessage in interface I18n
Overrides:
getMessage in class I18nWrapper
Parameters:
facesContext - The current faces context.
locale - The locale of the message.
messageId - The id of the message.

getMessage

public String getMessage(javax.faces.context.FacesContext facesContext,
                         Locale locale,
                         String messageId,
                         Object... arguments)
Description copied from class: I18nWrapper
See I18n.getMessage(FacesContext, Locale, String, Object...)

Specified by:
getMessage in interface I18n
Overrides:
getMessage in class I18nWrapper
Parameters:
facesContext - The current faces context.
locale - The locale of the message.
messageId - The id of the message.
arguments - The values that are to be inserted according to the MessageFormat pattern.

getWrapped

public I18n getWrapped()
Specified by:
getWrapped in interface javax.faces.FacesWrapper<I18n>
Specified by:
getWrapped in class I18nWrapper

newConcurrentMessageCache

protected Cache<String,String> newConcurrentMessageCache(javax.faces.context.ExternalContext externalContext)
Returns a new message cache to be used by I18nBundleBase. The default implementation returns a Cache instance obtained from CacheFactory.getConcurrentCacheInstance(javax.faces.context.ExternalContext, int) (passing 16 as the initial cache capacity). The cache will be stored in the application map. This method is called from the constructor of I18nBundleBase, so this method must not cause side effects and should not expect I18nBundleBase (or its subclass) to be fully initialized.

Parameters:
externalContext - The external context associated with the current FacesContext.


Copyright © 2019 Liferay, Inc.. All rights reserved.