You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by peter royal <pr...@apache.org> on 2006/07/03 17:13:18 UTC

Re: Adding class types to encoder??

On Jun 29, 2006, at 1:49 PM, Samuel Doyle wrote:
> Any way I can make it so that I don't have to add every specific  
> instance of a message I want to encode to the types list in my  
> encoder?
>
> I would basically just like a base class and have that as the only  
> type in my encoder types.

Sorry for the delay, I was traveling back to NYC from Dublin :)

You're using the DemuxingProtocolCodecFactory?

I'd recommend just making your own factory that has the logic that  
you want.

-pete


-- 
proyal@apache.org - http://fotap.org/~osi




Re: Adding class types to encoder??

Posted by peter royal <pr...@apache.org>.
On Jul 3, 2006, at 11:43 AM, Trustin Lee wrote:
> On 7/4/06, peter royal <pr...@apache.org> wrote:
>>
>> On Jun 29, 2006, at 1:49 PM, Samuel Doyle wrote:
>> > Any way I can make it so that I don't have to add every specific
>> > instance of a message I want to encode to the types list in my
>> > encoder?
>> >
>> > I would basically just like a base class and have that as the only
>> > type in my encoder types.
>>
>> Sorry for the delay, I was traveling back to NYC from Dublin :)
>>
>> You're using the DemuxingProtocolCodecFactory?
>>
>> I'd recommend just making your own factory that has the logic that
>> you want.
>
>
> I think we can do this using the reflection API climbing up the class
> hierarchy and interface list.  Of course, there will be overhead of  
> extra
> memory allocation because backtracking algorithm should be used for  
> it.  I
> can implement it very easily though because I have an experience  
> about it.

You can probably just compute that once when adding the mapping to  
save time @ runtime.

-pete


-- 
proyal@apache.org - http://fotap.org/~osi




Re: Adding class types to encoder??

Posted by Trustin Lee <tr...@gmail.com>.
On 7/4/06, peter royal <pr...@apache.org> wrote:
>
> On Jun 29, 2006, at 1:49 PM, Samuel Doyle wrote:
> > Any way I can make it so that I don't have to add every specific
> > instance of a message I want to encode to the types list in my
> > encoder?
> >
> > I would basically just like a base class and have that as the only
> > type in my encoder types.
>
> Sorry for the delay, I was traveling back to NYC from Dublin :)
>
> You're using the DemuxingProtocolCodecFactory?
>
> I'd recommend just making your own factory that has the logic that
> you want.


I think we can do this using the reflection API climbing up the class
hierarchy and interface list.  Of course, there will be overhead of extra
memory allocation because backtracking algorithm should be used for it.  I
can implement it very easily though because I have an experience about it.

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6