Class DefaultRPCFactory
java.lang.Object
eu.cloudnetservice.driver.network.rpc.defaults.DefaultRPCFactory
- All Implemented Interfaces:
RPCFactory
@Singleton
@Provides(RPCFactory.class)
public final class DefaultRPCFactory
extends Object
implements RPCFactory
The default factory implementation for everything related to rpc.
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DataBufFactoryprivate final ObjectMapperprivate final RPCGenerationCache -
Constructor Summary
ConstructorsConstructorDescriptionDefaultRPCFactory(@NonNull ObjectMapper defaultObjectMapper, @NonNull DataBufFactory defaultDataBufFactory) Constructs a new default rpc provider factory instance. -
Method Summary
Modifier and TypeMethodDescriptionGet the default data buf factory used by this mapper.Get the default object mapper used by this factory.<T> @NonNull RPCImplementationBuilder<T> newRPCBasedImplementationBuilder(@NonNull Class<T> baseClass) Constructs a builder for an RPC-based api implementation for all non-static methods in the given base class.<T> @NonNull RPCHandler.Builder<T> newRPCHandlerBuilder(@NonNull Class<T> target) Constructs a new rpc handler builder which can handle RPC requests for the given target class.newRPCSenderBuilder(@NonNull Class<?> target) Constructs a new builder for an RPC sender which can provide RPCs for the given target class and all subclasses in the tree.
-
Field Details
-
defaultObjectMapper
-
defaultDataBufFactory
-
rpcGenerationCache
-
-
Constructor Details
-
DefaultRPCFactory
@Inject public DefaultRPCFactory(@NonNull @NonNull ObjectMapper defaultObjectMapper, @NonNull @NonNull DataBufFactory defaultDataBufFactory) Constructs a new default rpc provider factory instance.- Parameters:
defaultObjectMapper- the default object mapper to use if no object mapper is provided in factory calls.defaultDataBufFactory- the default data buf factory to use if no object mapper is provided in factory calls.- Throws:
NullPointerException- if either the given object mapper or data buf factory is null.
-
-
Method Details
-
newRPCSenderBuilder
Constructs a new builder for an RPC sender which can provide RPCs for the given target class and all subclasses in the tree.- Specified by:
newRPCSenderBuilderin interfaceRPCFactory- Parameters:
target- the target class for which the rpc sender should be constructed.- Returns:
- a builder for an RPC sender that targets the given target class.
-
newRPCHandlerBuilder
Constructs a new rpc handler builder which can handle RPC requests for the given target class.- Specified by:
newRPCHandlerBuilderin interfaceRPCFactory- Type Parameters:
T- the target type.- Parameters:
target- the target class that should be handled by the RPC handler.- Returns:
- a new builder for an RPC handler which can handle RPC requests for the given target class.
-
newRPCBasedImplementationBuilder
@NonNull public <T> @NonNull RPCImplementationBuilder<T> newRPCBasedImplementationBuilder(@NonNull @NonNull Class<T> baseClass) Constructs a builder for an RPC-based api implementation for all non-static methods in the given base class.- Specified by:
newRPCBasedImplementationBuilderin interfaceRPCFactory- Type Parameters:
T- the type being implemented.- Parameters:
baseClass- the base class which should be implemented.- Returns:
- a builder for a base implementation of the given base class.
-
defaultObjectMapper
Get the default object mapper used by this factory.- Returns:
- the default object mapper.
-
defaultDataBufFactory
Get the default data buf factory used by this mapper.- Returns:
- the default data buf factory.
-