Class DefaultRPCSender

java.lang.Object
eu.cloudnetservice.driver.network.rpc.defaults.DefaultRPCProvider
eu.cloudnetservice.driver.network.rpc.defaults.sender.DefaultRPCSender
All Implemented Interfaces:
RPCProvider, RPCSender

@Internal public final class DefaultRPCSender extends DefaultRPCProvider implements RPCSender
The default implementation of an RPC sender.
Since:
4.0
  • Field Details

  • Constructor Details

  • Method Details

    • invokeCaller

      @NonNull public @NonNull RPC invokeCaller(Object... args)
      Returns a new RPC that can invoke the calling method with the provided arguments.
      Specified by:
      invokeCaller in interface RPCSender
      Parameters:
      args - the arguments to supply when invoking the method.
      Returns:
      an RPC that calls the caller method on a remote component with the provided arguments.
    • invokeCallerWithOffset

      @NonNull public @NonNull RPC invokeCallerWithOffset(int callerStackOffset, Object... args)
      Returns a new RPC that can invoke the calling method with the provided arguments.
      Specified by:
      invokeCallerWithOffset in interface RPCSender
      Parameters:
      callerStackOffset - the offset on the stack where the target method is located.
      args - the arguments to supply when invoking the method.
      Returns:
      an RPC that calls the caller method on a remote component with the provided arguments.
    • invokeMethod

      @NonNull public @NonNull RPC invokeMethod(@NonNull @NonNull String methodName, Object... args)
      Tries to resolve a distinct method with the given name and argument count in the target class and returns a new RPC that can invoke the resolved method with the provided arguments.
      Specified by:
      invokeMethod in interface RPCSender
      Parameters:
      methodName - the name of the method to invoke.
      args - the arguments to supply when invoking the method.
      Returns:
      an RPC to invoke the resolved method with the given name and parameter count on the remote.
    • invokeMethod

      @NonNull public @NonNull RPC invokeMethod(@NonNull @NonNull String methodName, @NonNull @NonNull TypeDescriptor methodDesc, Object... args)
      Returns a new RPC that can invoke the method with the given name and descriptor.
      Specified by:
      invokeMethod in interface RPCSender
      Parameters:
      methodName - the name of the method to invoke.
      methodDesc - the descriptor of the method to invoke.
      args - the arguments to supply for the method invocation.
      Returns:
      an RPC to invoke the resolved method with the given parameters on a remote.
    • invokeMethod

      @NonNull private @NonNull RPC invokeMethod(@NonNull @NonNull RPCMethodMetadata method, Object... args)
      Creates a new RPC to call the given target method with the given arguments.
      Parameters:
      method - the metadata of the method that should be called.
      args - the arguments of to supply to the target method.
      Returns:
      a new RPC instance targeting the given methods with the given arguments.
      Throws:
      NullPointerException - if the given method metadata or argument array is null.
      IllegalArgumentException - if the parameter count mismatches.