commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Benedict <pbened...@apache.org>
Subject Re: [convert] Automatic conversion based on proxies
Date Wed, 14 Aug 2013 20:11:25 GMT
The only danger of static methods is that you can't override them.
BeanUtils first suffered from this fate and they then made an instance
version (BeanUtils2). Just said plainly, you can't customize well using
factory classes/methods.


On Wed, Aug 14, 2013 at 3:04 PM, Emmanuel Bourg <ebourg@apache.org> wrote:

> Le 14/08/2013 17:39, Adrian Crum a écrit :
>
>  Instead of
>>
>> int columnInt = record.getValueAsInt(1);
>>
>> the developer would use
>>
>> Integer columnInt = Util.convertTo(record.**getValue(1), Integer.class);
>>
>
> +1 for the static method, that would allow the use of a static import and
> a very concise syntax like:
>
>     Integer columnInt = to(Integer.class, record.getValue(1));
>
>
> That being said, [convert] could offer several patterns to perform type
> conversion, and the use of proxies could be one of them.
>
>
> Emmanuel Bourg
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: dev-unsubscribe@commons.**apache.org<dev-unsubscribe@commons.apache.org>
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
Cheers,
Paul

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message