I am reading the documentation and cannot seem to find anything explicit.
Let's say that I have a protobuf definition MyObject.pb
.
I create an object of type MyObject
and set each of its fields to some meaningful value. And assume all the values are proto primitives (int, floats, strings...).
Say that I store these values as a representing string that follows the same syntax as the definition.
e.g if MyObject.pb looks like:
message Person {
required string name = 1;
required int32 id = 2;
optional string email = 3;
}
And the associated saved file looks like:
message Person {
required string name = aStringName;
required int32 id = 100;
optional string email = ex@mple.com;
}
Is there a way to automatically initialize the protobuffer by giving the constructor the path to the representing string as an argument? or do you have to do the parsing manually?