Gang -

According to the discussion in this thread, it sounds as if we were looking for a way to be able to set arbitrary transient (non-state-saved) properties on UIComponent instances.  In particular, Leonardo stated that:

these methods will be used by the vdl or renderers

Martin also mentioned:

adding some methods (getter/setter) on UIComponent, to make possible
manipulate them from "outside"the component instance

Leonardo's original proposal - adding public get/putTransient() method on UIComponent - accomplishes this goal.

However, while reviewing the 20101013 API doc for UIComponent, I see that access to these transient properties from "outside" of the component instance is no longer possible.  There are no public get/putTransient() methods on UIComponent.  getTransientStateHelper() is protected.  This means that arbitrary external access to transient properties is not supported.  Is this by design?

Also, looking at TransientStateHelper, I see that the property keys are declared as Serializable.  However, isn't the point that these transient properties are per-request and will not be state saved?  Who is serializing this data?  Unless I am missing some reason why this transient data is being serialized, we should change the type of the property key to Object.

Andy

On 9/20/10 9:12 PM, Leonardo Uribe wrote:
Hi Martin

I have been thinking a lot about it and for this one just add two simple methods on UIComponent could do the job:

    public Object getTransient(Serializable key)
    {
        TransientStateHelper helper = getTransientStateHelper(false);
        if (helper != null)
        {
            return helper.get(key);
        }
        return null;
    }
   
    public Object putTransient(Serializable key, Object value)
    {
        return getTransientStateHelper().put(key, value);
    }


Just like TransientStateHelper.

In theory, these methods will be used by the vdl or renderers, so this two simple methods will handle these cases correctly.

>From my point of view, these methods in some way looks similar to the ones used for handle ValueBinding / ValueExpression on UIComponent.

best regards,

Leonardo Uribe

2010/9/16 Martin Marinschek <mmarinschek@apache.org>
Hi Leo,

> I was thinking if the interface provided for handle transient properties
> should be exposed in some
> way, adding some methods (getter/setter) on UIComponent, to make possible
> manipulate them from "outside"
> the component instance. It will be very useful, specially for UIViewRoot.

+1!

what would be your proposed API?

best regards,

Martin


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces