You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Andrew Robinson <an...@gmail.com> on 2010/02/10 18:39:46 UTC

[Trinidad 2] Permission to change the API of CoreRenderer by adding a new final override and a new sub-class hook method for client behavior decoding (TRINIDAD-1715)

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

Re: [Trinidad 2] Permission to change the API of CoreRenderer by adding a new final override and a new sub-class hook method for client behavior decoding (TRINIDAD-1715)

Posted by Andrew Robinson <an...@gmail.com>.
I am wondering if this may not be a great idea as it may break people
since CoreRenderer is API and not IMPL. Any ideas on how I can do this
in a way to ensure that the client behaviors are decoded but not break
the API?

-Andrew

On Wed, Feb 10, 2010 at 10:39 AM, Andrew Robinson
<an...@gmail.com> wrote:
> 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
>

Re: [Trinidad 2] Permission to change the API of CoreRenderer by adding a new final override and a new sub-class hook method for client behavior decoding (TRINIDAD-1715)

Posted by Blake Sullivan <bl...@oracle.com>.
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
>