Package yandex.cloud.sdk
Class ServiceFactory
- java.lang.Object
-
- yandex.cloud.sdk.ServiceFactory
-
public class ServiceFactory extends Object
Factory class that creates gRPC stubs of given class. It retrieves correspondingManagedChannelobject, adds authentication headers and required interceptors.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classServiceFactory.ServiceFactoryBuilder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ServiceFactory.ServiceFactoryBuilderbuilder()Creates builder forServiceFactory<SERVICE extends io.grpc.stub.AbstractStub<SERVICE>>
SERVICEcreate(io.grpc.ManagedChannel channel, Function<io.grpc.Channel,SERVICE> service)Creates gRPC stub of given class with no timeout<SERVICE extends io.grpc.stub.AbstractStub<SERVICE>>
SERVICEcreate(io.grpc.ManagedChannel channel, Function<io.grpc.Channel,SERVICE> service, Duration timeout)Creates gRPC stub of given class with given timeout<SERVICE extends io.grpc.stub.AbstractStub<SERVICE>>
SERVICEcreate(Class<SERVICE> clazz, Function<io.grpc.Channel,SERVICE> service)Creates gRPC stub of given class with no timeout<SERVICE extends io.grpc.stub.AbstractStub<SERVICE>>
SERVICEcreate(Class<SERVICE> clazz, Function<io.grpc.Channel,SERVICE> service, Duration timeout)Creates gRPC stub of given class with given timeout
-
-
-
Method Detail
-
builder
public static ServiceFactory.ServiceFactoryBuilder builder()
Creates builder forServiceFactory- Returns:
ServiceFactory.ServiceFactoryBuilderobject
-
create
public <SERVICE extends io.grpc.stub.AbstractStub<SERVICE>> SERVICE create(Class<SERVICE> clazz, Function<io.grpc.Channel,SERVICE> service)
Creates gRPC stub of given class with no timeout- Type Parameters:
SERVICE- indicates a gRPC stub class- Parameters:
clazz- gRPC stub classservice- function that will be used to create gRPC stub- Returns:
- gRPC stub of given class
-
create
public <SERVICE extends io.grpc.stub.AbstractStub<SERVICE>> SERVICE create(Class<SERVICE> clazz, Function<io.grpc.Channel,SERVICE> service, Duration timeout)
Creates gRPC stub of given class with given timeout- Type Parameters:
SERVICE- indicates a gRPC stub class- Parameters:
clazz- gRPC stub classservice- function that will be used to create gRPC stubtimeout- timeout for gRPC calls that will be enforced on created stub- Returns:
- gRPC stub of given class
-
create
public <SERVICE extends io.grpc.stub.AbstractStub<SERVICE>> SERVICE create(io.grpc.ManagedChannel channel, Function<io.grpc.Channel,SERVICE> service)Creates gRPC stub of given class with no timeout- Type Parameters:
SERVICE- indicates a gRPC stub class- Parameters:
channel-ManagedChannelused to create a stubservice- function that will be used to create gRPC stub- Returns:
- gRPC stub of given class
-
create
public <SERVICE extends io.grpc.stub.AbstractStub<SERVICE>> SERVICE create(io.grpc.ManagedChannel channel, Function<io.grpc.Channel,SERVICE> service, Duration timeout)Creates gRPC stub of given class with given timeout- Type Parameters:
SERVICE- indicates a gRPC stub class- Parameters:
channel-ManagedChannelused to create a stubservice- function that will be used to create gRPC stubtimeout- timeout for gRPC calls that will be enforced on created stub- Returns:
- gRPC stub of given class
-
-