Class DefaultRPCInvocationContext

java.lang.Object
eu.cloudnetservice.driver.network.rpc.defaults.handler.DefaultRPCInvocationContext
All Implemented Interfaces:
RPCInvocationContext

public final class DefaultRPCInvocationContext extends Object implements RPCInvocationContext
The default implementation of an RPC invocation context.
Since:
4.0
  • Field Details

    • methodName

      private final String methodName
    • methodDescriptor

      private final String methodDescriptor
    • argumentInformation

      private final DataBuf argumentInformation
    • workingInstance

      private final Object workingInstance
  • Constructor Details

    • DefaultRPCInvocationContext

      private DefaultRPCInvocationContext(@NonNull @NonNull String methodName, @NonNull @NonNull String methodDescriptor, @NonNull @NonNull DataBuf argumentInformation, @Nullable @Nullable Object workingInstance)
      Constructs a new default RPC invocation context instance, only used by the builder.
      Parameters:
      methodName - the name of the method to invoke.
      methodDescriptor - the descriptor of the method to invoke.
      argumentInformation - the buffer containing the information about the arguments for the target method.
      workingInstance - the instance on which the method should be called, can be null.
      Throws:
      NullPointerException - if the given method name, descriptor or argument info is null.
  • Method Details

    • methodName

      @NonNull public @NonNull String methodName()
      Get the name of the method which should be invoked during the current rpc processing.
      Specified by:
      methodName in interface RPCInvocationContext
      Returns:
      the name of the method which should be invoked.
    • methodDescriptor

      @NonNull public @NonNull String methodDescriptor()
      Get the descriptor of the method that should be executed.
      Specified by:
      methodDescriptor in interface RPCInvocationContext
      Returns:
      the descriptor of the method that should be executed.
    • argumentInformation

      @NonNull public @NonNull DataBuf argumentInformation()
      Get the data buffer slice which should contain the argument information for the current method invocation. The buffer can contain more, unrelated data.
      Specified by:
      argumentInformation in interface RPCInvocationContext
      Returns:
      the data buffer which should contain the argument information for the current method invocation.
    • workingInstance

      @Nullable public @Nullable Object workingInstance()
      Get the instance (if any) which should be considered first for a method invocation. This is used for calling methods based on the result of the previous rpc in a chained rpc.
      Specified by:
      workingInstance in interface RPCInvocationContext
      Returns:
      the instance to use for calling the requested method (if any).