Interface StubFactory
- All Known Implementing Classes:
AsyncStubFactory
,BlockingStubFactory
,FallbackStubFactory
,FutureStubFactory
,StandardJavaGrpcStubFactory
public interface StubFactory
A factory for gRPC stubs. This is an extension mechanism for supporting different types of gRPC compiled stubs in
addition to the standard Java compiled gRPC.
Spring beans implementing this type will be picked up automatically and added to the list of supported types.
-
Method Summary
Modifier and TypeMethodDescriptionAbstractStub<?>
createStub
(Class<? extends AbstractStub<?>> stubType, Channel channel) Creates a stub of the given type.boolean
isApplicable
(Class<? extends AbstractStub<?>> stubType) Used to resolve a factory that matches the particular stub type.
-
Method Details
-
createStub
Creates a stub of the given type.- Parameters:
stubType
- The type of the stub to create.channel
- The channel used to create the stub.- Returns:
- The newly created stub.
- Throws:
BeanInstantiationException
- If the stub couldn't be created.
-
isApplicable
Used to resolve a factory that matches the particular stub type.- Parameters:
stubType
- The type of the stub that needs to be created.- Returns:
- True if this particular factory is capable of creating instances of this stub type. False otherwise.
-