Top Description Inners Fields Constructors Methods
io.grpc

public final Class ServiceDescriptor

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

Descriptor for a service.
Since
1.0.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final Collection<MethodDescriptor<?, ?>>
private final String
private final Object

Constructor Summary

AccessConstructor and Description
public
ServiceDescriptor(String
The name of the service
name
,
MethodDescriptor<?, ?>...
The methods that are part of the service
methods
)

Constructs a new Service Descriptor.

public
ServiceDescriptor(String
The name of the service
name
,
Collection<MethodDescriptor<?, ?>>
The methods that are part of the service
methods
)

Constructs a new Service Descriptor.

private

Method Summary

Modifier and TypeMethod and Description
public Collection<MethodDescriptor<?, ?>>
getMethods()

A collection of MethodDescriptor instances describing the methods exposed by the service.

public String
getName()

Simple name of the service.

public Object
getSchemaDescriptor()

Returns the schema descriptor for this service.

public static ServiceDescriptor.Builder
newBuilder(String name)

Creates a new builder for a ServiceDescriptor.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
pack-priv static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

methodsback to summary
private final Collection<MethodDescriptor<?, ?>> methods
nameback to summary
private final String name
schemaDescriptorback to summary
private final Object schemaDescriptor

Constructor Detail

ServiceDescriptorback to summary
public ServiceDescriptor(String name, MethodDescriptor<?, ?>... methods)

Constructs a new Service Descriptor. Users are encouraged to use newBuilder instead.

Parameters
name:String

The name of the service

methods:MethodDescriptor<?, ?>[]

The methods that are part of the service

Since
1.0.0
ServiceDescriptorback to summary
public ServiceDescriptor(String name, Collection<MethodDescriptor<?, ?>> methods)

Constructs a new Service Descriptor. Users are encouraged to use newBuilder instead.

Parameters
name:String

The name of the service

methods:Collection<MethodDescriptor<?, ?>>

The methods that are part of the service

Since
1.0.0
ServiceDescriptorback to summary
private ServiceDescriptor(ServiceDescriptor.Builder b)

Method Detail

getMethodsback to summary
public Collection<MethodDescriptor<?, ?>> getMethods()

A collection of MethodDescriptor instances describing the methods exposed by the service.

Since
1.0.0
getNameback to summary
public String getName()

Simple name of the service. It is not an absolute path.

Since
1.0.0
getSchemaDescriptorback to summary
public 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 calling getSchemaDescriptor() 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.

Annotations
@Nullable
@ExperimentalApi:https://github.com/grpc/grpc-java/issues/2222
Since
1.1.0
newBuilderback to summary
public static ServiceDescriptor.Builder newBuilder(String name)

Creates a new builder for a ServiceDescriptor.

Since
1.1.0
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
validateMethodNamesback to summary
pack-priv static void validateMethodNames(String serviceName, Collection<MethodDescriptor<?, ?>> methods)
io.grpc back to summary

public final Class ServiceDescriptor.Builder

extends Object
Class Inheritance

A builder for a ServiceDescriptor.
Since
1.1.0

Field Summary

Modifier and TypeField and Description
private List<MethodDescriptor<?, ?>>
private String
private Object

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private ServiceDescriptor.Builder

Returns:

this builder.
addAllMethods
(Collection<MethodDescriptor<?, ?>>
the methods to add.
methods
)

Currently not exposed.

public ServiceDescriptor.Builder

Returns:

this builder.
addMethod
(MethodDescriptor<?, ?>
the method to add to the descriptor.
method
)

Adds a method to this service.

public ServiceDescriptor

Returns:

a new ServiceDescriptor
build
()

Constructs a new ServiceDescriptor.

public ServiceDescriptor.Builder

Returns:

this builder.
setName
(String
The name of the service.
name
)

Sets the name.

public ServiceDescriptor.Builder

Returns:

this builder.
setSchemaDescriptor
(Object
an object that describes the service structure. Should be immutable.
schemaDescriptor
)

Sets the schema descriptor for this builder.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

methodsback to summary
private List<MethodDescriptor<?, ?>> methods
nameback to summary
private String name
schemaDescriptorback to summary
private Object schemaDescriptor

Constructor Detail

Builderback to summary
private Builder(String name)

Method Detail

addAllMethodsback to summary
private ServiceDescriptor.Builder addAllMethods(Collection<MethodDescriptor<?, ?>> methods)

Currently not exposed. Bulk adds methods to this builder.

Parameters
methods:Collection<MethodDescriptor<?, ?>>

the methods to add.

Returns:ServiceDescriptor.Builder

this builder.

addMethodback to summary
public ServiceDescriptor.Builder addMethod(MethodDescriptor<?, ?> method)

Adds a method to this service. This should be non-null.

Parameters
method:MethodDescriptor<?, ?>

the method to add to the descriptor.

Returns:ServiceDescriptor.Builder

this builder.

Since
1.1.0
buildback to summary
public ServiceDescriptor build()

Constructs a new ServiceDescriptor. setName should have been called with a non-null value before calling this.

Returns:ServiceDescriptor

a new ServiceDescriptor

Since
1.1.0
setNameback to summary
public ServiceDescriptor.Builder setName(String name)

Sets the name. This should be non-null.

Parameters
name:String

The name of the service.

Returns:ServiceDescriptor.Builder

this builder.

Annotations
@ExperimentalApi:https://github.com/grpc/grpc-java/issues/2666
Since
1.1.0
setSchemaDescriptorback to summary
public ServiceDescriptor.Builder setSchemaDescriptor(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 calling ServiceDescriptor#getSchemaDescriptor() must coordinate. For example, protobuf generated code sets this value, in order to be consumed by the server reflection service.

Parameters
schemaDescriptor:Object

an object that describes the service structure. Should be immutable.

Returns:ServiceDescriptor.Builder

this builder.

Since
1.1.0