0
鑑於以下的原定義:擴展在proto3
syntax = "proto3";
import "google/protobuf/descriptor.proto";
option java_package = "com.example.dto";
option java_multiple_files = true;
extend google.protobuf.FieldOptions {
Projector projector = 50002;
}
message Projector {
string name = 1;
string class = 2;
bool default = 3;
}
message SearchRequest {
string query = 1 [(projector) = {name: "queryProjector", class: "foobar"}];
int32 page_number = 2;
int32 result_per_page = 3;
}
我怎樣才能訪問域擴張?
據我瞭解擴展仍然在proto3中工作,但通常被替換爲Any
類型?
我來了,因爲這遠:
final Descriptors.Descriptor descriptor = SearchRequest.getDescriptor();
final Descriptors.FieldDescriptor query = descriptor.findFieldByName("query");
這是正確的方式?下一步是什麼?