Class DefaultRPCInvocationContext
java.lang.Object
eu.cloudnetservice.driver.network.rpc.defaults.handler.context.DefaultRPCInvocationContext
- All Implemented Interfaces:
RPCInvocationContext
The default implementation of a rpc invocation context.
- Since:
- 4.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface eu.cloudnetservice.driver.network.rpc.RPCInvocationContext
RPCInvocationContext.Builder -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intprotected final DataBufprotected final NetworkChannelprotected final booleanprotected final Stringprotected final booleanprotected final booleanprotected final Object -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefaultRPCInvocationContext(int argumentCount, boolean expectsMethodResult, boolean normalizePrimitives, boolean strictInstanceUsage, @NonNull String methodName, @NonNull NetworkChannel channel, @NonNull DataBuf arguments, @Nullable Object workingInstance) Constructs a new default rpc invocation context instance. -
Method Summary
Modifier and TypeMethodDescriptionintGet the amount of arguments the target method must have.Get the data buffer slice which should contain the argument information for the current method invocation.channel()Get the network channel from which the invocation request came.booleanGet if the rpc invocation expects a result sent back to the sender.Get the name of the method which should be invoked during the current rpc processing.booleanGet if primitive return values should be normalized when unprocessable due to for example null return values during a downstream method invocation.booleanGet if the instance supplied to this context must be used or if the rpc handler is free to use the instance to which its bound.Get the instance (if any) which should be considered first for a method invocation.
-
Field Details
-
argumentCount
protected final int argumentCount -
expectsMethodResult
protected final boolean expectsMethodResult -
normalizePrimitives
protected final boolean normalizePrimitives -
strictInstanceUsage
protected final boolean strictInstanceUsage -
methodName
-
channel
-
arguments
-
workingInstance
-
-
Constructor Details
-
DefaultRPCInvocationContext
protected DefaultRPCInvocationContext(int argumentCount, boolean expectsMethodResult, boolean normalizePrimitives, boolean strictInstanceUsage, @NonNull @NonNull String methodName, @NonNull @NonNull NetworkChannel channel, @NonNull @NonNull DataBuf arguments, @Nullable @Nullable Object workingInstance) Constructs a new default rpc invocation context instance.- Parameters:
argumentCount- the number of arguments the target method has.expectsMethodResult- if true the caller of the method expects a result being sent back to the sender.normalizePrimitives- if true primitive data types which are null will be normalized to their default value.strictInstanceUsage- if true the caller will not use any other instance than provided to this context.methodName- the name of the method to invoke.channel- the channel from which the invocation request came.arguments- the buffer containing the arguments for the method invocation.workingInstance- the instance to work with, null if no binding instance should be used.- Throws:
NullPointerException- if either the given method name, channel or argument buffer is null.
-
-
Method Details
-
argumentCount
public int argumentCount()Get the amount of arguments the target method must have.- Specified by:
argumentCountin interfaceRPCInvocationContext- Returns:
- the amount of arguments of the target method.
-
expectsMethodResult
public boolean expectsMethodResult()Get if the rpc invocation expects a result sent back to the sender.- Specified by:
expectsMethodResultin interfaceRPCInvocationContext- Returns:
- true if the rpc call expects a result, false otherwise.
-
normalizePrimitives
public boolean normalizePrimitives()Get if primitive return values should be normalized when unprocessable due to for example null return values during a downstream method invocation.- Specified by:
normalizePrimitivesin interfaceRPCInvocationContext- Returns:
- true if primitives should be normalized, false otherwise.
-
strictInstanceUsage
public boolean strictInstanceUsage()Get if the instance supplied to this context must be used or if the rpc handler is free to use the instance to which its bound.- Specified by:
strictInstanceUsagein interfaceRPCInvocationContext- Returns:
- true if the instance usage during processing should be strict, false otherwise.
-
methodName
Get the name of the method which should be invoked during the current rpc processing.- Specified by:
methodNamein interfaceRPCInvocationContext- Returns:
- the name of the method which should be invoked.
-
channel
Get the network channel from which the invocation request came.- Specified by:
channelin interfaceRPCInvocationContext- Returns:
- the network channel from which the invocation request came.
-
argumentInformation
Get the data buffer slice which should contain the argument information for the current method invocation. The buffer might however also contain information for the next rpc calls in the chain (if any).- Specified by:
argumentInformationin interfaceRPCInvocationContext- Returns:
- the data buffer which should contain the argument information for the current method invocation.
-
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:
workingInstancein interfaceRPCInvocationContext- Returns:
- the instance to use for calling the requested method (if any).
-