I would prefer that code fail in an obvious way--doesn't compile or link rather than have things not quite work right. So, if the choice is between CoreRenderer subclasses that overrode decode need to realize that they need change to call super and CoreRenderer subclasses fail to compile or link because decode is now final and they then read the new javadoc for decode that tells them to override the protected version, I'll go with the more obvious failure.

+1

-- Blake Sullivan

Andrew Robinson said the following On 2/10/2010 9:39 AM PT:
I need to add the ClientBehavior decoding logic to Trinidad as I
forgot to do it earlier
(https://issues.apache.org/jira/browse/TRINIDAD-1715). I would like to
put the logic in the renderer, not in UIXComponentBase as it makes
much more sense to have it there. I need to make sure the method is
called so that people don't subclass the method and forget to call the
parent method. I would like to make the following additions to
CoreRenderer:

  @Override
  public final void decode(
    FacesContext facesContext,
    UIComponent  component)
  {
    FacesBean facesBean = getFacesBean(component);
    String clientId = null;
    if (facesBean != null)
    {
      clientId = decodeBehaviors(facesContext, component, facesBean);
    }
    decode(facesContext, component, facesBean, clientId);
  }

  /**
   * Hook for sub-classes to perform their own decode logic
   * @param facesContext the faces context
   * @param component the component to decode
   * @param facesBean the faces bean for the component
   * @param clientId the client ID if it has been retrieved already
   * during decoding, otherwise it will be null. Passed in for performance
   * reasons, so that if it has already been retrieved it will not need to be
   * retrieved again
   */
  protected void decode(
    FacesContext facesContext,
    UIComponent component,
    FacesBean    facesBean,
    String           clientId)
  {
    // No-op
  }

Even though this seems the right thing to do, I know that any
renderers that sub-class CoreRenderer or XhtmlRenderer will need to be
updated. I will obviously convert the Trinidad renderers. Do you all
concur that this is the right thing to do, an also if you are okay
with the API of the new contract?

Thank you,
Andrew

Reply via email to