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 Details

  • 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

      @NonNull public RPCSender.Builder newRPCSenderBuilder(@NonNull @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.
      Specified by:
      newRPCSenderBuilder in interface RPCFactory
      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

      public <T> @NonNull RPCHandler.Builder<T> newRPCHandlerBuilder(@NonNull @NonNull Class<T> target)
      Constructs a new rpc handler builder which can handle RPC requests for the given target class.
      Specified by:
      newRPCHandlerBuilder in interface RPCFactory
      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:
      newRPCBasedImplementationBuilder in interface RPCFactory
      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

      @Internal @NonNull public @NonNull ObjectMapper defaultObjectMapper()
      Get the default object mapper used by this factory.
      Returns:
      the default object mapper.
    • defaultDataBufFactory

      @Internal @NonNull public @NonNull DataBufFactory defaultDataBufFactory()
      Get the default data buf factory used by this mapper.
      Returns:
      the default data buf factory.