Java Code Examples for com.google.protobuf.DescriptorProtos.FileDescriptorProto#hasOptions()
The following examples show how to use
com.google.protobuf.DescriptorProtos.FileDescriptorProto#hasOptions() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileDescriptor.java From servicetalk with Apache License 2.0 | 6 votes |
FileDescriptor(final FileDescriptorProto protoFile) { this.protoFile = protoFile; sanitizedProtoFileName = sanitizeFileName(protoFile.getName()); protoPackageName = protoFile.hasPackage() ? protoFile.getPackage() : null; if (protoFile.hasOptions()) { final FileOptions fileOptions = protoFile.getOptions(); deprecated = fileOptions.hasDeprecated() && fileOptions.getDeprecated(); multipleClassFiles = fileOptions.hasJavaMultipleFiles() && fileOptions.getJavaMultipleFiles(); javaPackageName = fileOptions.hasJavaPackage() ? fileOptions.getJavaPackage() : null; outerClassName = fileOptions.hasJavaOuterClassname() ? fileOptions.getJavaOuterClassname() : null; } else { deprecated = false; multipleClassFiles = false; javaPackageName = null; outerClassName = null; } serviceClassBuilders = new ArrayList<>(protoFile.getServiceCount()); }
Example 2
Source File: ProtobufDecompiler.java From sql-layer with GNU Affero General Public License v3.0 | 6 votes |
public void decompile(FileDescriptorProto fileDescriptor) throws IOException { if (fileDescriptor.hasPackage()) { indentedFormat("package %s;", fileDescriptor.getPackage()); absolutePackage = "." + fileDescriptor.getPackage() + "."; } for (String dependency : fileDescriptor.getDependencyList()) { indentedFormat("import \"%s\";", dependency); } if (fileDescriptor.hasOptions()) { decompileOptions(fileDescriptor.getOptions()); } decompileMembers(fileDescriptor.getEnumTypeList(), fileDescriptor.getMessageTypeList(), Collections.<FieldDescriptorProto>emptyList(), Collections.<DescriptorProto.ExtensionRange>emptyList(), fileDescriptor.getExtensionList()); for (ServiceDescriptorProto serviceDescriptor : fileDescriptor.getServiceList()) { decompile(serviceDescriptor); } newline(); flush(); }