Package io.grpc
Class ServiceDescriptor.Builder
java.lang.Object
io.grpc.ServiceDescriptor.Builder
- Enclosing class:
ServiceDescriptor
A builder for a
ServiceDescriptor
.- Since:
- 1.1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List
<MethodDescriptor<?, ?>> private String
private Object
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ServiceDescriptor.Builder
addAllMethods
(Collection<MethodDescriptor<?, ?>> methods) Currently not exposed.addMethod
(MethodDescriptor<?, ?> method) Adds a method to this service.build()
Constructs a newServiceDescriptor
.Sets the name.setSchemaDescriptor
(Object schemaDescriptor) Sets the schema descriptor for this builder.
-
Field Details
-
name
-
methods
-
schemaDescriptor
-
-
Constructor Details
-
Builder
-
-
Method Details
-
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
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
-
addAllMethods
Currently not exposed. Bulk adds methods to this builder.- Parameters:
methods
- the methods to add.- Returns:
- this builder.
-
setSchemaDescriptor
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
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
-