Package io.grpc
Class ServiceDescriptor.Builder
- java.lang.Object
-
- io.grpc.ServiceDescriptor.Builder
-
- Enclosing class:
- ServiceDescriptor
public static final class ServiceDescriptor.Builder extends java.lang.ObjectA builder for aServiceDescriptor.- Since:
- 1.1.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<MethodDescriptor<?,?>>methodsprivate java.lang.Stringnameprivate java.lang.ObjectschemaDescriptor
-
Constructor Summary
Constructors Modifier Constructor Description privateBuilder(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ServiceDescriptor.BuilderaddAllMethods(java.util.Collection<MethodDescriptor<?,?>> methods)Currently not exposed.ServiceDescriptor.BuilderaddMethod(MethodDescriptor<?,?> method)Adds a method to this service.ServiceDescriptorbuild()Constructs a newServiceDescriptor.ServiceDescriptor.BuildersetName(java.lang.String name)Sets the name.ServiceDescriptor.BuildersetSchemaDescriptor(java.lang.Object schemaDescriptor)Sets the schema descriptor for this builder.
-
-
-
Field Detail
-
name
private java.lang.String name
-
methods
private java.util.List<MethodDescriptor<?,?>> methods
-
schemaDescriptor
private java.lang.Object schemaDescriptor
-
-
Method Detail
-
setName
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2666") public ServiceDescriptor.Builder setName(java.lang.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
-
addAllMethods
private ServiceDescriptor.Builder addAllMethods(java.util.Collection<MethodDescriptor<?,?>> methods)
Currently not exposed. Bulk adds methods to this builder.- Parameters:
methods- the methods to add.- Returns:
- this builder.
-
setSchemaDescriptor
public ServiceDescriptor.Builder setSchemaDescriptor(@Nullable java.lang.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-nullvalue before calling this.- Returns:
- a new ServiceDescriptor
- Since:
- 1.1.0
-
-