extend google.protobuf.FieldOptions {
    optional string index1 = 10000;
    optional string index2 = 100001;
}
message order {
    required string id = 1
        [(index1) = "map"];
    required string name = 2
        [(index2) = "multimap" ];
}

I use the dynamic message to create and access the message as follows,

        const google::protobuf::FileDescriptor * 
fd=i->Import("order.proto");
        google::protobuf::DynamicMessageFactory factory;
        const google::protobuf::Descriptor * md= 
fd->FindMessageTypeByName("order");
        const google::protobuf::Message* no_prototype = 
factory.GetPrototype(md);
        google::protobuf::Message* msg = no_prototype->New();
        const pb::FieldDescriptor *fd = md->field(i);
        const pb::FieldOptions & fo = fd->options();

That is working fine, but how can I access the fields extensions from 
FieldOptions for a dynamic message ? 
Actually, I want to set few static attribute for some fields and retrieve 
those at runtime as same as getting the FieldDescriptor info from message 
descriptor. 

extend google.protobuf.FieldOptions {
    optional string index1 = 10000;
    optional string index2 = 100001;
}

message order {
    required string id = 1
        [(index1) = "map"];
    required string name = 2
        [(index2) = "multimap" ];
}

-- 
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 http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to