@Test public void testHandle() throws IOException { Descriptors.Descriptor personDescriptor = Person.getDescriptor(); FileDescriptorProto protoFile = personDescriptor.getFile().toProto(); TypeMap types = TypeMap.of(protoFile); ProtoFileHandler fileHandler = new ProtoFileHandler(types, new ByteArrayOutputStream()); fileHandler.handle(protoFile); }
public void handle(FileDescriptorProto protoFile) throws IOException { String javaPackage = inferJavaPackage(protoFile); boolean multipleFiles = protoFile.getOptions().getJavaMultipleFiles(); String outerClassName = null; if (!multipleFiles) { if (protoFile.getOptions().hasJavaOuterClassname()) { outerClassName = protoFile.getOptions().getJavaOuterClassname(); } else { outerClassName = inferOuterClassName(protoFile); } } ProtoServiceHandler serviceHandler = new ProtoServiceHandler(javaPackage, types, multipleFiles, outerClassName, protoFile.getPackage(), output); for (ServiceDescriptorProto service : protoFile.getServiceList()) { serviceHandler.handle(service); } }
ProtoFileHandler { public void handle(FileDescriptorProto protoFile) throws IOException { String javaPackage = inferJavaPackage(protoFile); boolean multipleFiles = protoFile.getOptions().getJavaMultipleFiles(); String outerClassName = null; if (!multipleFiles) { if (protoFile.getOptions().hasJavaOuterClassname()) { outerClassName = protoFile.getOptions().getJavaOuterClassname(); } else { outerClassName = inferOuterClassName(protoFile); } } ProtoServiceHandler serviceHandler = new ProtoServiceHandler(javaPackage, types, multipleFiles, outerClassName, protoFile.getPackage(), output); for (ServiceDescriptorProto service : protoFile.getServiceList()) { serviceHandler.handle(service); } } }
ProtoFileHandler { public void handle(FileDescriptorProto protoFile) throws IOException { String javaPackage = inferJavaPackage(protoFile); boolean multipleFiles = protoFile.getOptions().getJavaMultipleFiles(); String outerClassName = null; if (!multipleFiles) { if (protoFile.getOptions().hasJavaOuterClassname()) { outerClassName = protoFile.getOptions().getJavaOuterClassname(); } else { outerClassName = inferOuterClassName(protoFile); } } ProtoServiceHandler serviceHandler = new ProtoServiceHandler(javaPackage, types, multipleFiles, outerClassName, protoFile.getPackage(), output); for (ServiceDescriptorProto service : protoFile.getServiceList()) { serviceHandler.handle(service); } } ProtoFileHandler(TypeMap types, OutputStream output); }
ProtoFileHandler { public void handle(FileDescriptorProto protoFile) throws IOException { String javaPackage = inferJavaPackage(protoFile); boolean multipleFiles = protoFile.getOptions().getJavaMultipleFiles(); String outerClassName = null; if (!multipleFiles) { if (protoFile.getOptions().hasJavaOuterClassname()) { outerClassName = protoFile.getOptions().getJavaOuterClassname(); } else { outerClassName = inferOuterClassName(protoFile); } } ProtoServiceHandler serviceHandler = new ProtoServiceHandler(javaPackage, types, multipleFiles, outerClassName, protoFile.getPackage(), output); for (ServiceDescriptorProto service : protoFile.getServiceList()) { serviceHandler.handle(service); } } ProtoFileHandler(TypeMap types, OutputStream output); void handle(FileDescriptorProto protoFile); }
ProtoFileHandler { public void handle(FileDescriptorProto protoFile) throws IOException { String javaPackage = inferJavaPackage(protoFile); boolean multipleFiles = protoFile.getOptions().getJavaMultipleFiles(); String outerClassName = null; if (!multipleFiles) { if (protoFile.getOptions().hasJavaOuterClassname()) { outerClassName = protoFile.getOptions().getJavaOuterClassname(); } else { outerClassName = inferOuterClassName(protoFile); } } ProtoServiceHandler serviceHandler = new ProtoServiceHandler(javaPackage, types, multipleFiles, outerClassName, protoFile.getPackage(), output); for (ServiceDescriptorProto service : protoFile.getServiceList()) { serviceHandler.handle(service); } } ProtoFileHandler(TypeMap types, OutputStream output); void handle(FileDescriptorProto protoFile);  }