Top Description Inners Fields Constructors Methods
io.grpc

public final Class ServerServiceDefinition

extends Object
Class Inheritance
Static Imports
com.google.common.base.Preconditions.checkArgument, .Preconditions.checkNotNull, .Preconditions.checkState

Definition of a service to be exposed via a Server.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ServerServiceDefinition.Builder

Builder for constructing Service instances.

Field Summary

Modifier and TypeField and Description
private final Map<String, ServerMethodDefinition<?, ?>>
private final ServiceDescriptor

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ServerServiceDefinition.Builder
builder(String serviceName)

Convenience that constructs a ServiceDescriptor simultaneously.

public static ServerServiceDefinition.Builder
builder(ServiceDescriptor serviceDescriptor)

public ServerMethodDefinition<?, ?>
getMethod(String
the fully qualified name without leading slash. E.g., "com.foo.Foo/Bar"
methodName
)

Look up a method by its fully qualified name.

public Collection<ServerMethodDefinition<?, ?>>
getMethods()

Gets all the methods of service.

public ServiceDescriptor
getServiceDescriptor()

The descriptor for the service.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

methodsback to summary
private final Map<String, ServerMethodDefinition<?, ?>> methods
serviceDescriptorback to summary
private final ServiceDescriptor serviceDescriptor

Constructor Detail

ServerServiceDefinitionback to summary
private ServerServiceDefinition(ServiceDescriptor serviceDescriptor, Map<String, ServerMethodDefinition<?, ?>> methods)

Method Detail

builderback to summary
public static ServerServiceDefinition.Builder builder(String serviceName)

Convenience that constructs a ServiceDescriptor simultaneously.

builderback to summary
public static ServerServiceDefinition.Builder builder(ServiceDescriptor serviceDescriptor)
getMethodback to summary
public ServerMethodDefinition<?, ?> getMethod(String methodName)

Look up a method by its fully qualified name.

Parameters
methodName:String

the fully qualified name without leading slash. E.g., "com.foo.Foo/Bar"

Annotations
@Internal
getMethodsback to summary
public Collection<ServerMethodDefinition<?, ?>> getMethods()

Gets all the methods of service.

getServiceDescriptorback to summary
public ServiceDescriptor getServiceDescriptor()

The descriptor for the service.

io.grpc back to summary

public final Class ServerServiceDefinition.Builder

extends Object
Class Inheritance

Builder for constructing Service instances.

Field Summary

Modifier and TypeField and Description
private final Map<String, ServerMethodDefinition<?, ?>>
private final ServiceDescriptor
private final String

Constructor Summary

AccessConstructor and Description
private
Builder(String serviceName)

private
Builder(ServiceDescriptor serviceDescriptor)

Method Summary

Modifier and TypeMethod and Description
public <ReqT, RespT> ServerServiceDefinition.Builder
addMethod(MethodDescriptor<ReqT, RespT>
the MethodDescriptor of this method.
method
,
ServerCallHandler<ReqT, RespT>
handler for incoming calls
handler
)

Add a method to be supported by the service.

public <ReqT, RespT> ServerServiceDefinition.Builder
addMethod(ServerMethodDefinition<ReqT, RespT> def)

Add a method to be supported by the service.

public ServerServiceDefinition
build()

Construct new ServerServiceDefinition.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

methodsback to summary
private final Map<String, ServerMethodDefinition<?, ?>> methods
serviceDescriptorback to summary
private final ServiceDescriptor serviceDescriptor
serviceNameback to summary
private final String serviceName

Constructor Detail

Builderback to summary
private Builder(String serviceName)
Builderback to summary
private Builder(ServiceDescriptor serviceDescriptor)

Method Detail

addMethodback to summary
public <ReqT, RespT> ServerServiceDefinition.Builder addMethod(MethodDescriptor<ReqT, RespT> method, ServerCallHandler<ReqT, RespT> handler)

Add a method to be supported by the service.

Parameters
method:MethodDescriptor<ReqT, RespT>

the MethodDescriptor of this method.

handler:ServerCallHandler<ReqT, RespT>

handler for incoming calls

addMethodback to summary
public <ReqT, RespT> ServerServiceDefinition.Builder addMethod(ServerMethodDefinition<ReqT, RespT> def)

Add a method to be supported by the service.

buildback to summary
public ServerServiceDefinition build()

Construct new ServerServiceDefinition.