You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Lewis <ch...@bellsouth.net> on 2009/01/19 17:54:11 UTC

T5: ValueEncoderSource and Select's default encoder

Hi list,

I simply want to know how the Select component gets its encoder from the 
ValueEncoderSource service, when an encoder isn't explicitly provided as 
a parameter. Thanks!

-- 
http://thegodcode.net


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: ValueEncoderSource and Select's default encoder

Posted by Chris Lewis <ch...@bellsouth.net>.
I'd be surprised if I've overlooked it that long, but given how much the 
framework and its docs have evolved, it's certainly possible. Thanks again!

Ulrich Stärk wrote:
> I believe this was added back in 2007...
>
> Uli
>
> Chris Lewis schrieb:
>> Wow. Is that recent behavior? I've not been aware of the default* 
>> method convention before. Interesting indeed. Thanks for that!
>>
>> Ulrich Stärk wrote:
>>> IIRC from browsing through the source code this is done 
>>> automagically by type coercing from your type to String 
>>> (TypeCoercedValueEncoderFactory or something). The correspondig 
>>> Encoder is selected by the Select components defaultEncoder() 
>>> method, when no encoder parameter is provided (see the "Computed 
>>> Parameter Binding Defaults" section at 
>>> http://tapestry.apache.org/tapestry5/guide/parameters.html).
>>>
>>> Cheers,
>>>
>>> Uli
>>>
>>> Chris Lewis schrieb:
>>>> I am, but that's not my question. My question is how does the 
>>>> select component get a default value encoder when one is not 
>>>> provided as a parameter? The source suggests it comes from the 
>>>> ValueEncoderSource service, to which modules like 
>>>> tapestry-hibernate contribute. But nowhere in the select's source 
>>>> does the it access the ValueEncoderSource service. So, 
>>>> where/when/how does a default encoder get set?
>>>>
>>>> Thiago H. de Paula Figueiredo wrote:
>>>>> Em Mon, 19 Jan 2009 13:54:11 -0300, Chris Lewis 
>>>>> <ch...@bellsouth.net> escreveu:
>>>>>
>>>>>> Hi list,
>>>>>
>>>>> Hi!
>>>>>
>>>>>> I simply want to know how the Select component gets its encoder 
>>>>>> from the ValueEncoderSource service, when an encoder isn't 
>>>>>> explicitly provided as a parameter. Thanks!
>>>>>
>>>>> Are you using tapestry-hibernate? If yes, it provides 
>>>>> ValueEncoder's using Hibernate's ClassMetaData class.
>>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

-- 
http://thegodcode.net


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: ValueEncoderSource and Select's default encoder

Posted by Ulrich Stärk <ul...@spielviel.de>.
I believe this was added back in 2007...

Uli

Chris Lewis schrieb:
> Wow. Is that recent behavior? I've not been aware of the default* method 
> convention before. Interesting indeed. Thanks for that!
> 
> Ulrich Stärk wrote:
>> IIRC from browsing through the source code this is done automagically 
>> by type coercing from your type to String 
>> (TypeCoercedValueEncoderFactory or something). The correspondig 
>> Encoder is selected by the Select components defaultEncoder() method, 
>> when no encoder parameter is provided (see the "Computed Parameter 
>> Binding Defaults" section at 
>> http://tapestry.apache.org/tapestry5/guide/parameters.html).
>>
>> Cheers,
>>
>> Uli
>>
>> Chris Lewis schrieb:
>>> I am, but that's not my question. My question is how does the select 
>>> component get a default value encoder when one is not provided as a 
>>> parameter? The source suggests it comes from the ValueEncoderSource 
>>> service, to which modules like tapestry-hibernate contribute. But 
>>> nowhere in the select's source does the it access the 
>>> ValueEncoderSource service. So, where/when/how does a default encoder 
>>> get set?
>>>
>>> Thiago H. de Paula Figueiredo wrote:
>>>> Em Mon, 19 Jan 2009 13:54:11 -0300, Chris Lewis 
>>>> <ch...@bellsouth.net> escreveu:
>>>>
>>>>> Hi list,
>>>>
>>>> Hi!
>>>>
>>>>> I simply want to know how the Select component gets its encoder 
>>>>> from the ValueEncoderSource service, when an encoder isn't 
>>>>> explicitly provided as a parameter. Thanks!
>>>>
>>>> Are you using tapestry-hibernate? If yes, it provides ValueEncoder's 
>>>> using Hibernate's ClassMetaData class.
>>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: ValueEncoderSource and Select's default encoder

Posted by Chris Lewis <ch...@bellsouth.net>.
Wow. Is that recent behavior? I've not been aware of the default* method 
convention before. Interesting indeed. Thanks for that!

Ulrich Stärk wrote:
> IIRC from browsing through the source code this is done automagically 
> by type coercing from your type to String 
> (TypeCoercedValueEncoderFactory or something). The correspondig 
> Encoder is selected by the Select components defaultEncoder() method, 
> when no encoder parameter is provided (see the "Computed Parameter 
> Binding Defaults" section at 
> http://tapestry.apache.org/tapestry5/guide/parameters.html).
>
> Cheers,
>
> Uli
>
> Chris Lewis schrieb:
>> I am, but that's not my question. My question is how does the select 
>> component get a default value encoder when one is not provided as a 
>> parameter? The source suggests it comes from the ValueEncoderSource 
>> service, to which modules like tapestry-hibernate contribute. But 
>> nowhere in the select's source does the it access the 
>> ValueEncoderSource service. So, where/when/how does a default encoder 
>> get set?
>>
>> Thiago H. de Paula Figueiredo wrote:
>>> Em Mon, 19 Jan 2009 13:54:11 -0300, Chris Lewis 
>>> <ch...@bellsouth.net> escreveu:
>>>
>>>> Hi list,
>>>
>>> Hi!
>>>
>>>> I simply want to know how the Select component gets its encoder 
>>>> from the ValueEncoderSource service, when an encoder isn't 
>>>> explicitly provided as a parameter. Thanks!
>>>
>>> Are you using tapestry-hibernate? If yes, it provides ValueEncoder's 
>>> using Hibernate's ClassMetaData class.
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

-- 
http://thegodcode.net


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: ValueEncoderSource and Select's default encoder

Posted by Ulrich Stärk <ul...@spielviel.de>.
IIRC from browsing through the source code this is done automagically by 
type coercing from your type to String (TypeCoercedValueEncoderFactory 
or something). The correspondig Encoder is selected by the Select 
components defaultEncoder() method, when no encoder parameter is 
provided (see the "Computed Parameter Binding Defaults" section at 
http://tapestry.apache.org/tapestry5/guide/parameters.html).

Cheers,

Uli

Chris Lewis schrieb:
> I am, but that's not my question. My question is how does the select 
> component get a default value encoder when one is not provided as a 
> parameter? The source suggests it comes from the ValueEncoderSource 
> service, to which modules like tapestry-hibernate contribute. But 
> nowhere in the select's source does the it access the ValueEncoderSource 
> service. So, where/when/how does a default encoder get set?
> 
> Thiago H. de Paula Figueiredo wrote:
>> Em Mon, 19 Jan 2009 13:54:11 -0300, Chris Lewis 
>> <ch...@bellsouth.net> escreveu:
>>
>>> Hi list,
>>
>> Hi!
>>
>>> I simply want to know how the Select component gets its encoder from 
>>> the ValueEncoderSource service, when an encoder isn't explicitly 
>>> provided as a parameter. Thanks!
>>
>> Are you using tapestry-hibernate? If yes, it provides ValueEncoder's 
>> using Hibernate's ClassMetaData class.
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: ValueEncoderSource and Select's default encoder

Posted by Howard Lewis Ship <hl...@gmail.com>.
In Select.java:

  ValueEncoder defaultEncoder()
    {
        return defaultProvider.defaultValueEncoder("value", resources);
    }

In ComponentDefaultProvider.java:

   /**
     * Gets or creates a value encoder based on the <em>type</em> of
the named parameter.  ValueEncoders are cached
     * based on type.
     *
     * @param parameterName the name of the parameter whose type is
used to locate a {@link
     *                      org.apache.tapestry5.services.ValueEncoderFactory}
     * @param resources     the resources of the component, from which
parameter and its type are extracted
     * @return the value encoder, or null if the type of the parameter
is not known
     */
    ValueEncoder defaultValueEncoder(String parameterName,
ComponentResources resources);


And so it goes, one facade after another!


On Mon, Jan 19, 2009 at 9:11 AM, Chris Lewis <ch...@bellsouth.net> wrote:
> I am, but that's not my question. My question is how does the select
> component get a default value encoder when one is not provided as a
> parameter? The source suggests it comes from the ValueEncoderSource service,
> to which modules like tapestry-hibernate contribute. But nowhere in the
> select's source does the it access the ValueEncoderSource service. So,
> where/when/how does a default encoder get set?
>
> Thiago H. de Paula Figueiredo wrote:
>>
>> Em Mon, 19 Jan 2009 13:54:11 -0300, Chris Lewis
>> <ch...@bellsouth.net> escreveu:
>>
>>> Hi list,
>>
>> Hi!
>>
>>> I simply want to know how the Select component gets its encoder from the
>>> ValueEncoderSource service, when an encoder isn't explicitly provided as a
>>> parameter. Thanks!
>>
>> Are you using tapestry-hibernate? If yes, it provides ValueEncoder's using
>> Hibernate's ClassMetaData class.
>>
>
> --
> http://thegodcode.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: ValueEncoderSource and Select's default encoder

Posted by Chris Lewis <ch...@bellsouth.net>.
I am, but that's not my question. My question is how does the select 
component get a default value encoder when one is not provided as a 
parameter? The source suggests it comes from the ValueEncoderSource 
service, to which modules like tapestry-hibernate contribute. But 
nowhere in the select's source does the it access the ValueEncoderSource 
service. So, where/when/how does a default encoder get set?

Thiago H. de Paula Figueiredo wrote:
> Em Mon, 19 Jan 2009 13:54:11 -0300, Chris Lewis 
> <ch...@bellsouth.net> escreveu:
>
>> Hi list,
>
> Hi!
>
>> I simply want to know how the Select component gets its encoder from 
>> the ValueEncoderSource service, when an encoder isn't explicitly 
>> provided as a parameter. Thanks!
>
> Are you using tapestry-hibernate? If yes, it provides ValueEncoder's 
> using Hibernate's ClassMetaData class.
>

-- 
http://thegodcode.net


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: ValueEncoderSource and Select's default encoder

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Mon, 19 Jan 2009 13:54:11 -0300, Chris Lewis  
<ch...@bellsouth.net> escreveu:

> Hi list,

Hi!

> I simply want to know how the Select component gets its encoder from the  
> ValueEncoderSource service, when an encoder isn't explicitly provided as  
> a parameter. Thanks!

Are you using tapestry-hibernate? If yes, it provides ValueEncoder's using  
Hibernate's ClassMetaData class.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org