Uploaded image for project: 'PUBLIC - Liferay Faces'
  1. PUBLIC - Liferay Faces
  2. FACES-2797

Rename com.liferay.faces.util.context.MessageContext to com.liferay.faces.util.i18n.I18n and refactor the method signatures according to the Flyweight pattern

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:

    I18n.java
    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);
    

    Attachments

      Activity

        People

          ui_faces UI Faces
          neil.griffin Neil Griffin
          Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

            Created:
            Updated:
            Resolved:

            Packages

              Version Package
              alloy-1.0.0
              alloy-2.0.0
              alloy-3.0.0
              portal-1.0.0
              portal-2.0.0
              portal-3.0.0
              util-1.0.0
              util-2.0.0
              util-3.0.0
              bridge-impl-3.0.0
              metal-1.0.0
              bridge-impl-4.0.0
              bridge-impl-5.0.0
              bridge-impl-6.0.0