Hello All,
      I'm a bit confused on the use of protobuf.Any.

I assumed that when I made a message with an Any in it like so;
                    

*    message* Parameter {

*        string* Name = 1;

        google.protobuf.Any Value = 2;

   }


    And another message to feed in the 'Any' type;


    message AnyParameterType {}




That I would be able to use the 'AnyParameterType  to put 'any' data type I 
wanted such as Int, Double, String, etc... into the Parameter message.

But I can't figure out how to use the AnyParameterType.Builder.setField() 
method to do this. The problem I'm having is creating an instance of 
FieldDescriptor to pass into the setField() method.


Is manually passing in a FieldDescriptor instance and an Object of my 
choice the right approach for using my AnyParameterType message?


If so, could you provide an example of how to create the 
FieldDescriptor instance? 


Or do I have this all wrong? And what I really need to do is create a 
'message' type for every data type I want to use, like so;

     message IntType {

         Int value = 1;

    }


    message DoubleType {

        Double value = 1;

    }


    message StringType {

        String value = 1;

    }


I did try one of these 'type specific' messages, and it worked (I was able 
to pass it into Any.pack()), but it seems like this would result in having 
to rebuild my .proto file any time I came up with a new data type.


Thanks in advance for a push in the right direction.



-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to