Package io.grpc
Class ServiceDescriptor.Builder
- java.lang.Object
-
- io.grpc.ServiceDescriptor.Builder
-
- Enclosing class:
- ServiceDescriptor
public static final class ServiceDescriptor.Builder extends Object
A builder for aServiceDescriptor
.- Since:
- 1.1.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServiceDescriptor.Builder
addMethod(MethodDescriptor<?,?> method)
Adds a method to this service.ServiceDescriptor
build()
Constructs a newServiceDescriptor
.ServiceDescriptor.Builder
setName(String name)
Sets the name.ServiceDescriptor.Builder
setSchemaDescriptor(Object schemaDescriptor)
Sets the schema descriptor for this builder.
-
-
-
Method Detail
-
setName
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2666") public ServiceDescriptor.Builder setName(String name)
Sets the name. This should be non-null
.- Parameters:
name
- The name of the service.- Returns:
- this builder.
- Since:
- 1.1.0
-
addMethod
public ServiceDescriptor.Builder addMethod(MethodDescriptor<?,?> method)
Adds a method to this service. This should be non-null
.- Parameters:
method
- the method to add to the descriptor.- Returns:
- this builder.
- Since:
- 1.1.0
-
setSchemaDescriptor
public ServiceDescriptor.Builder setSchemaDescriptor(@Nullable Object schemaDescriptor)
Sets the schema descriptor for this builder. A schema descriptor is an object that is not used by gRPC core but includes information related to the service. The type of the object is specific to the consumer, so both the code calling this and the code callingServiceDescriptor.getSchemaDescriptor()
must coordinate. For example, protobuf generated code sets this value, in order to be consumed by the server reflection service.- Parameters:
schemaDescriptor
- an object that describes the service structure. Should be immutable.- Returns:
- this builder.
- Since:
- 1.1.0
-
build
public ServiceDescriptor build()
Constructs a newServiceDescriptor
.setName(java.lang.String)
should have been called with a non-null
value before calling this.- Returns:
- a new ServiceDescriptor
- Since:
- 1.1.0
-
-