本文整理汇总了Java中com.google.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceDescriptorProto.Builder方法的具体用法?Java ServiceDescriptorProto.Builder怎么用?Java ServiceDescriptorProto.Builder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.protobuf.DescriptorProtos.ServiceDescriptorProto
的用法示例。
在下文中一共展示了ServiceDescriptorProto.Builder方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeCanonicalProto
import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
private FileDescriptorProto makeCanonicalProto(final FileDescriptor fileDescriptor) {
final FileDescriptorProto.Builder protoBuilder =
FileDescriptorProto.newBuilder(fileDescriptor.toProto());
for (final FieldDescriptorProto.Builder field : protoBuilder.getExtensionBuilderList()) {
makeCanonicalField(field, fileDescriptor.findExtensionByName(field.getName()));
}
for (final DescriptorProto.Builder message : protoBuilder.getMessageTypeBuilderList()) {
makeCanonicalMessage(message, fileDescriptor.findMessageTypeByName(message.getName()));
}
// for (EnumDescriptorProto.Builder enumProto :
// protoBuilder.getEnumTypeBuilderList()) {
// makeCanonicalEnum(enumProto,
// fileDescriptor.findEnumTypeByName(enumProto.getName()));
// }
for (final ServiceDescriptorProto.Builder serviceProto : protoBuilder.getServiceBuilderList()) {
makeCanonicalService(serviceProto, fileDescriptor.findServiceByName(serviceProto.getName()));
}
// TODO: incorporate options' tree walking into canonicalization to eliminate double walking
return OptionResolver.newBuilder().setCustomOptionsAsExtensions(false)
.resolveAllOptionsFor(fileDescriptor, protoBuilder).build();
}
示例2: buildAllOptions
import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
private void buildAllOptions(final FileDescriptorProto.Builder proto) {
if (!buildOptions(proto.getOptionsBuilder())) {
proto.clearOptions();
}
for (final FieldDescriptorProto.Builder extensionProto : proto.getExtensionBuilderList()) {
if (!buildOptions(extensionProto.getOptionsBuilder())) {
extensionProto.clearOptions();
}
}
for (final EnumDescriptorProto.Builder enumProto : proto.getEnumTypeBuilderList()) {
buildAllOptions(enumProto);
}
for (final ServiceDescriptorProto.Builder serviceProto : proto.getServiceBuilderList()) {
buildAllOptions(serviceProto);
}
for (final DescriptorProto.Builder messageProto : proto.getMessageTypeBuilderList()) {
buildAllOptions(messageProto);
}
}
示例3: makeCanonicalProto
import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
private FileDescriptorProto makeCanonicalProto(final FileDescriptor file) {
final FileDescriptorProto.Builder protoBuilder = FileDescriptorProto.newBuilder(file.toProto());
for (final FieldDescriptorProto.Builder field : protoBuilder.getExtensionBuilderList()) {
makeCanonicalField(field, file.findExtensionByName(field.getName()));
}
for (final DescriptorProto.Builder message : protoBuilder.getMessageTypeBuilderList()) {
makeCanonicalMessage(message, file.findMessageTypeByName(message.getName()));
}
// for (EnumDescriptorProto.Builder enumProto :
// protoBuilder.getEnumTypeBuilderList()) {
// makeCanonicalEnum(enumProto,
// file.findEnumTypeByName(enumProto.getName()));
// }
for (final ServiceDescriptorProto.Builder serviceProto : protoBuilder.getServiceBuilderList()) {
makeCanonicalService(serviceProto, file.findServiceByName(serviceProto.getName()));
}
return OptionResolver.newBuilder().setCustomOptionsAsExtensions(reparseCustomOptions)
.resolveAllOptionsFor(file, protoBuilder).build();
}
示例4: generateApi
import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
private ServiceDescriptorProto generateApi(Api api) {
ServiceDescriptorProto.Builder builder = ServiceDescriptorProto.newBuilder();
builder.setName(getSimpleName(api.getName()));
for (Method method : api.getMethodsList()) {
builder.addMethod(generateMethod(method));
}
if (!api.getOptionsList().isEmpty()) {
builder.setOptions(generateServiceOptions(api));
}
return builder.build();
}
示例5: accept
import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
@Accepts
protected void accept(ServiceDescriptorProto.Builder service) {
pushParent(BuilderVisitorNodeInfo.create(service, currentFile));
visitRepeated(ServiceDescriptorProto.METHOD_FIELD_NUMBER);
visit(service.getOptionsBuilder());
popExpectedParent(service);
}
示例6: makeCanonicalService
import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
private void makeCanonicalService(final ServiceDescriptorProto.Builder service,
final ServiceDescriptor serviceDescriptor) {
for (final MethodDescriptorProto.Builder method : service.getMethodBuilderList()) {
final MethodDescriptor methodDescriptor =
serviceDescriptor.findMethodByName(method.getName());
method.setInputType(ensureLeadingDot(methodDescriptor.getInputType().getFullName()));
method.setOutputType(ensureLeadingDot(methodDescriptor.getOutputType().getFullName()));
}
}
示例7: exitService
import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
@Override
public void exitService(final ServiceContext ctx) {
final ServiceDescriptorProto.Builder serviceBuilder =
ServiceDescriptorProto.Builder.class.cast(scopes.getProtoBuilder());
serviceBuilder.setName(ctx.identifier().getText());
scopes.popScope();
}
示例8: addService
import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
public ServiceDescriptorProto.Builder addService() {
final ServiceDescriptorProto.Builder builder = currentScope.addService();
pushScope(new ServiceScope(builder, currentScope));
return builder;
}
示例9: ServiceScope
import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
private ServiceScope(final ServiceDescriptorProto.Builder protoBuilder, final Scope<?> parent) {
super(protoBuilder, parent);
}