Java Code Examples for com.google.protobuf.Descriptors.ServiceDescriptor#getMethods()

The following examples show how to use com.google.protobuf.Descriptors.ServiceDescriptor#getMethods() . 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: ProtoReflectionService.java    From grpc-nebula-java with Apache License 2.0 6 votes vote down vote up
private void processService(ServiceDescriptor service, FileDescriptor fd) {
  String serviceName = service.getFullName();
  checkState(
      !fileDescriptorsBySymbol.containsKey(serviceName),
      "Service already defined: %s",
      serviceName);
  fileDescriptorsBySymbol.put(serviceName, fd);
  for (MethodDescriptor method : service.getMethods()) {
    String methodName = method.getFullName();
    checkState(
        !fileDescriptorsBySymbol.containsKey(methodName),
        "Method already defined: %s",
        methodName);
    fileDescriptorsBySymbol.put(methodName, fd);
  }
}
 
Example 2
Source File: ProtoReflectionService.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
private void processService(ServiceDescriptor service, FileDescriptor fd) {
  String serviceName = service.getFullName();
  checkState(
      !fileDescriptorsBySymbol.containsKey(serviceName),
      "Service already defined: %s",
      serviceName);
  fileDescriptorsBySymbol.put(serviceName, fd);
  for (MethodDescriptor method : service.getMethods()) {
    String methodName = method.getFullName();
    checkState(
        !fileDescriptorsBySymbol.containsKey(methodName),
        "Method already defined: %s",
        methodName);
    fileDescriptorsBySymbol.put(methodName, fd);
  }
}
 
Example 3
Source File: ProtocolBuffersMetaData.java    From BIMserver with GNU Affero General Public License v3.0 5 votes vote down vote up
public ServiceDescriptorContainer(ServiceDescriptor serviceDescriptor) {
	this.serviceDescriptor = serviceDescriptor;
	for (MethodDescriptor methodDescriptor : serviceDescriptor.getMethods()) {
		this.methodDescriptors.put(
			methodDescriptor.getName(), 
			new MethodDescriptorContainer(this, methodDescriptor)
		);
	}
}
 
Example 4
Source File: ProtoGenerator.java    From fuchsia with Apache License 2.0 5 votes vote down vote up
private void generateProtoFromDescriptor(ServiceDescriptor descriptor,
                                         Appendable out) throws IOException {
    out.append("service " + descriptor.getName() + " {\n");
    for (MethodDescriptor methodDescriptor : descriptor.getMethods()) {
        generateProtoFromDescriptor(methodDescriptor, out);
    }
    out.append("}\n");
}