Hi; that is protobuf-net, which has a very different API to some of the core
google libs. It supports use frmo .proto, but is also intended to work
reasonably nicely with common / existing .NET types (that /aren't/ generated
from .proto).

To that end - it indeed supports generics at runtime; this largely works
like templates. To reproduce this in .proto, you'd need a different message
(or family of messages) per "T" that you expect.

Marc


2010/3/20 sun stenpher <stenp...@gmail.com>

> Hi!
> Thanks for your reply. and sorry for my tarrible English..
> I mean that :
> Does protobuf support java generic type?
> I saw some code in .Net like this:
>      ...
>     [ProtoContract]
>     public class IMASResults<T>
>     {
>         [ProtoMember(1)]
>         [DataMember]
>         public int ResultCode;
>         [ProtoMember(2)]
>         [DataMember]
>         public T ResultValue;
>         public IMASResults()
>         {
>
>         }
>         public IMASResults(int resultCode, T value)
>         {
>             ResultCode = resultCode;
>             ResultValue = value;
>         }
>         public IMASResults(IMASResultCode resultCode, T value)
>         {
>             ResultCode = (int)resultCode;
>             ResultValue = value;
>         }
>         public IMASResults(int resultCode)
>         {
>             ResultCode = resultCode;
>             ResultValue = default(T);
>         }
>         public IMASResults(IMASResultCode resultCode)
>         {
>             ResultCode = (int)resultCode;
>             ResultValue = default(T);
>         }
>     }
>  ....
>
> the "public *T* ResultValue" is a generic type in .Net I think, and now I
> have to communicate with the .Net system in Java, so I want to know: How can
> I defin the "ResultValue" in the .proto file use to generate java code.
>
> thanks!
>
> 在 2010年3月20日 下午2:51,sunxing <sunx...@feinno.com>写道:
>
>>  thank you very much!
>>
>>
>> 2010-03-20
>> ------------------------------
>>  sunxing
>> ------------------------------
>> *发件人:* Kenton Varda
>> *发送时间:* 2010-03-20  02:56:04
>> *收件人:* kso
>> *抄送:* Protocol Buffers; 孙星
>> *主题:* Re: [protobuf] do the protocol buffer support java generics?
>>  No, the .proto language has no concept of type parameterization.
>>
>> On Fri, Mar 19, 2010 at 1:06 AM, kso <stenp...@gmail.com> wrote:
>>
>>> hi protobuf team!
>>>
>>> do the protocol buffer support java generics? if support, how can I
>>> define the .proto file ?
>>>
>>>
>>> thanks!
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Protocol Buffers" group.
>>> To post to this group, send email to proto...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/protobuf?hl=en.
>>>
>>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to proto...@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>



-- 
Regards,

Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to