pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Volkert <tvolk...@gmail.com>
Subject Re: WTKXSerializer#bind
Date Tue, 03 Nov 2009 21:40:21 GMT
If you have B extends A, and they both call wtkxSerializer.bind(this), then
they'll potentially accidentally overwrite each others' private variables.
 This signature allows the serializer to know which annotations (and
correspondingly, which variables) are in play.  It's unfortunate, but
needed.

-T

On Tue, Nov 3, 2009 at 4:28 PM, Greg Brown <gkbrown@mac.com> wrote:

> It allows the caller to specify which members to bind to. Without the type
> argument, bind() would need to walk up the type hierarchy and attempt to
> bind to each superclass of the calling class as well as the class itself. In
> fact, it used to work that way, and at the moment I can't remember why we
> changed it. The single-arg signature does seem more intuitive.
>
>
>
> On Nov 3, 2009, at 4:17 PM, Christopher Brind wrote:
>
>  Hi,
>>
>> Just wondering what the logic is behind having two arguments for the
>> bind method on the WTKXSerializer?
>>
>> Instead of:
>>
>>   public <T> void bind(T t, Class<? super T> type) throws BindException
{
>>>      Field[] fields = type.getDeclaredFields();
>>>
>>
>> Why not:
>>
>>   public <T> void bind(T t) throws BindException {
>>>      Field[] fields = t.getClass().getDeclaredFields();
>>>
>>
>> In fact, why is this parameterised at all?  Wouldn't this suffice?
>>
>>   public void bind(Object t) throws BindException {
>>>      Field[] fields = t.getClass().getDeclaredFields();
>>>
>>
>>
>> Cheers,
>> Chris
>>
>
>

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