Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
The com.liferay.faces.util.context.MessageContext interface is inappropriately named since it is not a contextual object. Rather it is a simple service for obtaining internationalized messages of type java.lang.String or javax.faces.application.FacesMessage. Another problem is that it has a dependency on FacesContext which is not evident by the method signatures. For example, the default MessageContextImpl implementation calls FacesContext.getCurrentInstance() in order to obtain the message bundle associated with javax.faces.application.Application.
This issue serves as a task for renaming the following interfaces and classes:
- com.liferay.faces.util.context.MessageContext -> com.liferay.faces.util.i18n.I18n
- com.liferay.faces.util.context.MessageContextWrapper -> com.liferay.faces.util.i18n.I18nWrapper
- com.liferay.faces.util.context.MessageContextFactory -> com.liferay.faces.util.i18n.I18nFactory
In addition, the method signatures will be simplified/minimized and the FacesContext will be passed as a parameter to each method in order to facilitate the Flyweight Pattern:
public FacesMessage getFacesMessage(FacesContext facesContext, Locale locale, FacesMessage.Severity severity, String messageId); public FacesMessage getFacesMessage(FacesContext facesContext, Locale locale, FacesMessage.Severity severity, String messageId, Object... arguments); public String getMessage(FacesContext facesContext, Locale locale, String messageId); public String getMessage(FacesContext facesContext, Locale locale, String messageId, Object... arguments);