Package org.astonbitecode.j4rs.api
Interface NativeInvocation<T>
-
- All Superinterfaces:
JsonValue,ObjectValue
- All Known Implementing Classes:
EagerJsonInvocationImpl,JsonInvocationImpl
public interface NativeInvocation<T> extends ObjectValue, JsonValue
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static <T> NativeInvocationcast(NativeInvocation from, String toClass)Casts a the object that is contained in a NativeInvocation to an object of class clazz.static <T> NativeInvocationcloneInstance(NativeInvocation from)Clones a NativeInvocationNativeInvocationfield(String fieldName)Retrieves the instance held under the Field fieldNamevoidinitializeCallbackChannel(long channelAddress)Initialize a callback channel for thisNativeInvocation.NativeInvocationinvoke(String methodName, InvocationArg... args)Invokes a method of the instance of the class that is set for thisNativeInvocationvoidinvokeAsync(long functionPointerAddress, String methodName, InvocationArg... args)Invokes asynchronously a method of the instance of the class that is set for thisNativeInvocation.NativeInvocationinvokeStatic(String methodName, InvocationArg... args)Invokes a static method of the class that is set for thisNativeInvocationvoidinvokeToChannel(long channelAddress, String methodName, InvocationArg... args)Invokes a method of the instance of the class that is set for thisNativeInvocation.-
Methods inherited from interface org.astonbitecode.j4rs.api.ObjectValue
getObject, getObjectClass
-
-
-
-
Method Detail
-
invoke
NativeInvocation invoke(String methodName, InvocationArg... args)
Invokes a method of the instance of the class that is set for thisNativeInvocation- Parameters:
methodName- The method nameargs- The arguments to use for invoking the method- Returns:
- A
NativeInvocationinstance containing the result of the invocation
-
invokeStatic
NativeInvocation invokeStatic(String methodName, InvocationArg... args)
Invokes a static method of the class that is set for thisNativeInvocation- Parameters:
methodName- The static method nameargs- The arguments to use for invoking the static method- Returns:
- A
NativeInvocationinstance containing the result of the invocation
-
invokeAsync
void invokeAsync(long functionPointerAddress, String methodName, InvocationArg... args)Invokes asynchronously a method of the instance of the class that is set for thisNativeInvocation. The result of the invocation should be provided later using the performCallback method of aNativeCallbackSupportclass. Any possible returned objects from the actual synchronous invocation of the defined method will be dropped.- Parameters:
functionPointerAddress- The address of the function pointer that will be used later in the native side in order to actually paerform the callback.methodName- The method nameargs- The arguments to use when invoking the callback method (the functionPointer)
-
invokeToChannel
void invokeToChannel(long channelAddress, String methodName, InvocationArg... args)Invokes a method of the instance of the class that is set for thisNativeInvocation. The result of the invocation should be provided later using the doCallback method of aNativeCallbackToRustChannelSupportclass. Any possible returned objects from the actual synchronous invocation of the defined method will be dropped.- Parameters:
channelAddress- The memory address of the channelmethodName- The method nameargs- The arguments
-
initializeCallbackChannel
void initializeCallbackChannel(long channelAddress)
Initialize a callback channel for thisNativeInvocation. The channel can be used by Java to send values to Rust using the doCallback method of aNativeCallbackToRustChannelSupportclass.- Parameters:
channelAddress- The memory address of the channel
-
field
NativeInvocation field(String fieldName)
Retrieves the instance held under the Field fieldName- Parameters:
fieldName- The name of the field to retrieve- Returns:
- A
NativeInvocationinstance containing the defined field.
-
cast
static <T> NativeInvocation cast(NativeInvocation from, String toClass)
Casts a the object that is contained in a NativeInvocation to an object of class clazz.- Type Parameters:
T- Generically defined return type- Parameters:
from- TheNativeInvocationto cast.toClass- The class that the providedNativeInvocationshould be casted to- Returns:
- A
NativeInvocationinstance containing the result of the cast.
-
cloneInstance
static <T> NativeInvocation cloneInstance(NativeInvocation from)
Clones a NativeInvocation- Type Parameters:
T- Generically defined return type- Parameters:
from- The object to clone.- Returns:
- a
NativeInvocationinstance.
-
-