Package io.grpc
Class ServiceDescriptor
- java.lang.Object
-
- io.grpc.ServiceDescriptor
-
public final class ServiceDescriptor extends java.lang.Object
Descriptor for a service.- Since:
- 1.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ServiceDescriptor.Builder
A builder for aServiceDescriptor
.
-
Field Summary
Fields Modifier and Type Field Description private java.util.Collection<MethodDescriptor<?,?>>
methods
private java.lang.String
name
private java.lang.Object
schemaDescriptor
-
Constructor Summary
Constructors Modifier Constructor Description private
ServiceDescriptor(ServiceDescriptor.Builder b)
ServiceDescriptor(java.lang.String name, MethodDescriptor<?,?>... methods)
Constructs a new Service Descriptor.ServiceDescriptor(java.lang.String name, java.util.Collection<MethodDescriptor<?,?>> methods)
Constructs a new Service Descriptor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<MethodDescriptor<?,?>>
getMethods()
A collection ofMethodDescriptor
instances describing the methods exposed by the service.java.lang.String
getName()
Simple name of the service.java.lang.Object
getSchemaDescriptor()
Returns the schema descriptor for this service.static ServiceDescriptor.Builder
newBuilder(java.lang.String name)
Creates a new builder for aServiceDescriptor
.java.lang.String
toString()
(package private) static void
validateMethodNames(java.lang.String serviceName, java.util.Collection<MethodDescriptor<?,?>> methods)
-
-
-
Field Detail
-
name
private final java.lang.String name
-
methods
private final java.util.Collection<MethodDescriptor<?,?>> methods
-
schemaDescriptor
private final java.lang.Object schemaDescriptor
-
-
Constructor Detail
-
ServiceDescriptor
public ServiceDescriptor(java.lang.String name, MethodDescriptor<?,?>... methods)
Constructs a new Service Descriptor. Users are encouraged to usenewBuilder(java.lang.String)
instead.- Parameters:
name
- The name of the servicemethods
- The methods that are part of the service- Since:
- 1.0.0
-
ServiceDescriptor
public ServiceDescriptor(java.lang.String name, java.util.Collection<MethodDescriptor<?,?>> methods)
Constructs a new Service Descriptor. Users are encouraged to usenewBuilder(java.lang.String)
instead.- Parameters:
name
- The name of the servicemethods
- The methods that are part of the service- Since:
- 1.0.0
-
ServiceDescriptor
private ServiceDescriptor(ServiceDescriptor.Builder b)
-
-
Method Detail
-
getName
public java.lang.String getName()
Simple name of the service. It is not an absolute path.- Since:
- 1.0.0
-
getMethods
public java.util.Collection<MethodDescriptor<?,?>> getMethods()
A collection ofMethodDescriptor
instances describing the methods exposed by the service.- Since:
- 1.0.0
-
getSchemaDescriptor
@Nullable @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2222") public java.lang.Object getSchemaDescriptor()
Returns the schema descriptor for this service. 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 setting the schema descriptor and the code callinggetSchemaDescriptor()
must coordinate. For example, protobuf generated code sets this value, in order to be consumed by the server reflection service. See also:io.grpc.protobuf.ProtoFileDescriptorSupplier
.- Since:
- 1.1.0
-
validateMethodNames
static void validateMethodNames(java.lang.String serviceName, java.util.Collection<MethodDescriptor<?,?>> methods)
-
newBuilder
public static ServiceDescriptor.Builder newBuilder(java.lang.String name)
Creates a new builder for aServiceDescriptor
.- Since:
- 1.1.0
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-