Class JsonInvocationImpl<T>
- java.lang.Object
-
- org.astonbitecode.j4rs.api.NativeInvocationBase
-
- org.astonbitecode.j4rs.api.invocation.JsonInvocationImpl<T>
-
- All Implemented Interfaces:
JsonValue
,NativeInvocation<T>
,ObjectValue
public class JsonInvocationImpl<T> extends NativeInvocationBase implements NativeInvocation<T>
-
-
Constructor Summary
Constructors Constructor Description JsonInvocationImpl(Class<T> clazz)
JsonInvocationImpl(T instance, Class<T> clazz)
JsonInvocationImpl(T instance, Class<T> clazz, List<Type> classGenTypes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NativeInvocation
field(String fieldName)
Retrieves the instance held under the Field fieldNameString
getJson()
T
getObject()
Class<T>
getObjectClass()
void
initializeCallbackChannel(long channelAddress)
Initialize a callback channel for thisNativeInvocation
.NativeInvocation
invoke(String methodName, InvocationArg... args)
Invokes a method of the instance of the class that is set for thisNativeInvocation
void
invokeAsync(long functionPointerAddress, String methodName, InvocationArg... args)
Invokes asynchronously a method of the instance of the class that is set for thisNativeInvocation
.NativeInvocation
invokeStatic(String methodName, InvocationArg... args)
Invokes a static method of the class that is set for thisNativeInvocation
void
invokeToChannel(long channelAddress, String methodName, InvocationArg... args)
Invokes a method of the instance of the class that is set for thisNativeInvocation
.-
Methods inherited from class org.astonbitecode.j4rs.api.NativeInvocationBase
cast, cloneInstance
-
-
-
-
Method Detail
-
invoke
public NativeInvocation invoke(String methodName, InvocationArg... args)
Description copied from interface:NativeInvocation
Invokes a method of the instance of the class that is set for thisNativeInvocation
- Specified by:
invoke
in interfaceNativeInvocation<T>
- Parameters:
methodName
- The method nameargs
- The arguments to use for invoking the method- Returns:
- A
NativeInvocation
instance containing the result of the invocation
-
invokeStatic
public NativeInvocation invokeStatic(String methodName, InvocationArg... args)
Description copied from interface:NativeInvocation
Invokes a static method of the class that is set for thisNativeInvocation
- Specified by:
invokeStatic
in interfaceNativeInvocation<T>
- Parameters:
methodName
- The static method nameargs
- The arguments to use for invoking the static method- Returns:
- A
NativeInvocation
instance containing the result of the invocation
-
invokeAsync
public void invokeAsync(long functionPointerAddress, String methodName, InvocationArg... args)
Description copied from interface:NativeInvocation
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 aNativeCallbackSupport
class. Any possible returned objects from the actual synchronous invocation of the defined method will be dropped.- Specified by:
invokeAsync
in interfaceNativeInvocation<T>
- 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
public void invokeToChannel(long channelAddress, String methodName, InvocationArg... args)
Description copied from interface:NativeInvocation
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 aNativeCallbackToRustChannelSupport
class. Any possible returned objects from the actual synchronous invocation of the defined method will be dropped.- Specified by:
invokeToChannel
in interfaceNativeInvocation<T>
- Parameters:
channelAddress
- The memory address of the channelmethodName
- The method nameargs
- The arguments
-
initializeCallbackChannel
public void initializeCallbackChannel(long channelAddress)
Description copied from interface:NativeInvocation
Initialize a callback channel for thisNativeInvocation
. The channel can be used by Java to send values to Rust using the doCallback method of aNativeCallbackToRustChannelSupport
class.- Specified by:
initializeCallbackChannel
in interfaceNativeInvocation<T>
- Parameters:
channelAddress
- The memory address of the channel
-
field
public NativeInvocation field(String fieldName)
Description copied from interface:NativeInvocation
Retrieves the instance held under the Field fieldName- Specified by:
field
in interfaceNativeInvocation<T>
- Parameters:
fieldName
- The name of the field to retrieve- Returns:
- A
NativeInvocation
instance containing the defined field.
-
getObject
public T getObject()
- Specified by:
getObject
in interfaceObjectValue
-
getObjectClass
public Class<T> getObjectClass()
- Specified by:
getObjectClass
in interfaceObjectValue
-
-