Interface IJavaObject
- Namespace
- MASES.JCOBridge.C2JBridge.JVMInterop
- Assembly
- C2JBridge.dll
Interface to directly access all objects allocated from JVM. Provides instance method invocation, field access, and type conversion over the JNI bridge exposed by JCOBridge.
public interface IJavaObject : IJavaObjectBase, IDisposable
- Inherited Members
- Extension Methods
Methods
GetField(string)
Reads the value of an instance field on the underlying JVM object.
object GetField(string fieldName)
Parameters
fieldNamestringThe name of the Java instance field to read.
Returns
- object
The field value as a boxed object. Reference types are returned as IJavaObject instances; primitive types are boxed to their .NET equivalents.
Exceptions
- InvalidOperationException
Thrown if no field named
fieldNameis found on the underlying Java class.
GetField<TReturn>(string)
Reads the value of an instance field on the underlying JVM object
and casts it to TReturn.
TReturn GetField<TReturn>(string fieldName)
Parameters
fieldNamestringThe name of the Java instance field to read.
Returns
- TReturn
The field value cast to
TReturn.
Type Parameters
TReturnThe expected field type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- InvalidOperationException
Thrown if no field named
fieldNameis found on the underlying Java class.- InvalidCastException
Thrown if the actual field value cannot be cast to
TReturn.
Invoke(string)
Invokes an instance method on the underlying JVM object with no arguments.
object Invoke(string methodName)
Parameters
methodNamestringThe name of the Java instance method to invoke.
Returns
Exceptions
- MissingMethodException
Thrown if no matching method is found on the underlying Java class.
Invoke(string, object)
Invokes an instance method on the underlying JVM object with 1 argument.
object Invoke(string methodName, object arg0)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument type.
Invoke(string, object, object)
Invokes an instance method on the underlying JVM object with 2 arguments.
object Invoke(string methodName, object arg0, object arg1)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
Invoke(string, object, object, object)
Invokes an instance method on the underlying JVM object with 3 arguments.
object Invoke(string methodName, object arg0, object arg1, object arg2)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
Invoke(string, object, object, object, object)
Invokes an instance method on the underlying JVM object with 4 arguments.
object Invoke(string methodName, object arg0, object arg1, object arg2, object arg3)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
Invoke(string, object, object, object, object, object)
Invokes an instance method on the underlying JVM object with 5 arguments.
object Invoke(string methodName, object arg0, object arg1, object arg2, object arg3, object arg4)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
Invoke(string, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object with 6 arguments.
object Invoke(string methodName, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
Invoke(string, object, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object with 7 arguments.
object Invoke(string methodName, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
arg6objectThe seventh argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
Invoke(string, object, object, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object with 8 arguments.
object Invoke(string methodName, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
arg6objectThe seventh argument to pass to the method.
arg7objectThe eighth argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
Invoke(string, object, object, object, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object with 9 arguments.
object Invoke(string methodName, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
arg6objectThe seventh argument to pass to the method.
arg7objectThe eighth argument to pass to the method.
arg8objectThe ninth argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
Invoke(string, object, object, object, object, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object with 10 arguments.
object Invoke(string methodName, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
arg6objectThe seventh argument to pass to the method.
arg7objectThe eighth argument to pass to the method.
arg8objectThe ninth argument to pass to the method.
arg9objectThe tenth argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
Invoke(string, params object[])
Invokes an instance method on the underlying JVM object using a variable-length argument list. The bridge resolves the target Java method by matching the runtime types of the supplied arguments.
object Invoke(string methodName, params object[] args)
Parameters
methodNamestringThe name of the Java instance method to invoke.
argsobject[]The arguments to pass to the method. Each element must be a type compatible with the corresponding Java parameter: primitive types, IJavaObject instances, or .NET arrays of primitive types.
Returns
Remarks
Use this overload when the number of arguments is not known at compile time. For a fixed, known number of arguments (0–10), prefer the strongly-typed overloads to avoid the overhead of array allocation.
Exceptions
- MissingMethodException
Thrown if no method matching
methodNamewith the inferred signature is found.
InvokeWithSignature(string, string)
Invokes an instance method on the underlying JVM object using an explicit JNI signature and no arguments.
object InvokeWithSignature(string methodName, string signature)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
Returns
Remarks
Use this overload when method overload resolution by argument types alone is ambiguous,
or when you want to pin the call to a specific Java method descriptor.
The JNI signature format follows the standard Java descriptor notation,
e.g. "()V" for a void method with no parameters.
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.
InvokeWithSignature(string, string, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature and 1 argument.
object InvokeWithSignature(string methodName, string signature, object arg0)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.
InvokeWithSignature(string, string, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature and 2 arguments.
object InvokeWithSignature(string methodName, string signature, object arg0, object arg1)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.
InvokeWithSignature(string, string, object, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature and 3 arguments.
object InvokeWithSignature(string methodName, string signature, object arg0, object arg1, object arg2)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.
InvokeWithSignature(string, string, object, object, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature and 4 arguments.
object InvokeWithSignature(string methodName, string signature, object arg0, object arg1, object arg2, object arg3)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.
InvokeWithSignature(string, string, object, object, object, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature and 5 arguments.
object InvokeWithSignature(string methodName, string signature, object arg0, object arg1, object arg2, object arg3, object arg4)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.
InvokeWithSignature(string, string, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature and 6 arguments.
object InvokeWithSignature(string methodName, string signature, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.
InvokeWithSignature(string, string, object, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature and 7 arguments.
object InvokeWithSignature(string methodName, string signature, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
arg6objectThe seventh argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.
InvokeWithSignature(string, string, object, object, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature and 8 arguments.
object InvokeWithSignature(string methodName, string signature, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
arg6objectThe seventh argument to pass to the method.
arg7objectThe eighth argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.
InvokeWithSignature(string, string, object, object, object, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature and 9 arguments.
object InvokeWithSignature(string methodName, string signature, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
arg6objectThe seventh argument to pass to the method.
arg7objectThe eighth argument to pass to the method.
arg8objectThe ninth argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.
InvokeWithSignature(string, string, object, object, object, object, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature and 10 arguments.
object InvokeWithSignature(string methodName, string signature, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
arg6objectThe seventh argument to pass to the method.
arg7objectThe eighth argument to pass to the method.
arg8objectThe ninth argument to pass to the method.
arg9objectThe tenth argument to pass to the method.
Returns
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.
InvokeWithSignature(string, string, params object[])
Invokes an instance method on the underlying JVM object using an explicit JNI signature and a variable-length argument list.
object InvokeWithSignature(string methodName, string signature, params object[] args)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
argsobject[]The arguments to pass to the method. Each element must be compatible with the corresponding Java parameter type declared in
signature.
Returns
Remarks
The explicit signature is resolved at the JNI level before dispatching the call,
so this overload is suitable when multiple Java overloads share the same name and the
bridge cannot unambiguously select the right one from the argument types alone.
For a fixed, known number of arguments (0–10), prefer the strongly-typed overloads
to avoid the overhead of array allocation.
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.
InvokeWithSignature<TReturn>(string, string)
Invokes an instance method on the underlying JVM object using an explicit JNI signature,
no arguments, and casts the result to TReturn.
TReturn InvokeWithSignature<TReturn>(string methodName, string signature)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
InvokeWithSignature<TReturn>(string, string, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature,
1 argument, and casts the result to TReturn.
TReturn InvokeWithSignature<TReturn>(string methodName, string signature, object arg0)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
InvokeWithSignature<TReturn>(string, string, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature,
2 arguments, and casts the result to TReturn.
TReturn InvokeWithSignature<TReturn>(string methodName, string signature, object arg0, object arg1)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
InvokeWithSignature<TReturn>(string, string, object, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature,
3 arguments, and casts the result to TReturn.
TReturn InvokeWithSignature<TReturn>(string methodName, string signature, object arg0, object arg1, object arg2)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
InvokeWithSignature<TReturn>(string, string, object, object, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature,
4 arguments, and casts the result to TReturn.
TReturn InvokeWithSignature<TReturn>(string methodName, string signature, object arg0, object arg1, object arg2, object arg3)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
InvokeWithSignature<TReturn>(string, string, object, object, object, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature,
5 arguments, and casts the result to TReturn.
TReturn InvokeWithSignature<TReturn>(string methodName, string signature, object arg0, object arg1, object arg2, object arg3, object arg4)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
InvokeWithSignature<TReturn>(string, string, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature,
6 arguments, and casts the result to TReturn.
TReturn InvokeWithSignature<TReturn>(string methodName, string signature, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
InvokeWithSignature<TReturn>(string, string, object, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature,
7 arguments, and casts the result to TReturn.
TReturn InvokeWithSignature<TReturn>(string methodName, string signature, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
arg6objectThe seventh argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
InvokeWithSignature<TReturn>(string, string, object, object, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature,
8 arguments, and casts the result to TReturn.
TReturn InvokeWithSignature<TReturn>(string methodName, string signature, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
arg6objectThe seventh argument to pass to the method.
arg7objectThe eighth argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
InvokeWithSignature<TReturn>(string, string, object, object, object, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature,
9 arguments, and casts the result to TReturn.
TReturn InvokeWithSignature<TReturn>(string methodName, string signature, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
arg6objectThe seventh argument to pass to the method.
arg7objectThe eighth argument to pass to the method.
arg8objectThe ninth argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
InvokeWithSignature<TReturn>(string, string, object, object, object, object, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object using an explicit JNI signature,
10 arguments, and casts the result to TReturn.
TReturn InvokeWithSignature<TReturn>(string methodName, string signature, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
arg6objectThe seventh argument to pass to the method.
arg7objectThe eighth argument to pass to the method.
arg8objectThe ninth argument to pass to the method.
arg9objectThe tenth argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
InvokeWithSignature<TReturn>(string, string, params object[])
Invokes an instance method on the underlying JVM object using an explicit JNI signature,
a variable-length argument list, and casts the result to TReturn.
TReturn InvokeWithSignature<TReturn>(string methodName, string signature, params object[] args)
Parameters
methodNamestringThe name of the Java instance method to invoke.
signaturestringThe JNI method descriptor string that uniquely identifies the target method.
argsobject[]The arguments to pass to the method. Each element must be compatible with the corresponding Java parameter type declared in
signature.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types (int, long, bool, etc.), Enum, and arrays of primitive types.
Remarks
The explicit signature is resolved at the JNI level before dispatching the call,
so this overload is suitable when multiple Java overloads share the same name and the
bridge cannot unambiguously select the right one from the argument types alone.
For a fixed, known number of arguments (0–10), prefer the strongly-typed overloads
to avoid the overhead of array allocation.
Exceptions
- MissingMethodException
Thrown if the method identified by
methodNameandsignatureis not found on the underlying Java class.- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
Invoke<TReturn>(string)
Invokes an instance method on the underlying JVM object with no arguments
and casts the result to TReturn.
TReturn Invoke<TReturn>(string methodName)
Parameters
methodNamestringThe name of the Java instance method to invoke.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types (int, long, bool, etc.), Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if no matching method is found on the underlying Java class.
- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
Invoke<TReturn>(string, object)
Invokes an instance method on the underlying JVM object with 1 argument
and casts the result to TReturn.
TReturn Invoke<TReturn>(string methodName, object arg0)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument type.
- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
Invoke<TReturn>(string, object, object)
Invokes an instance method on the underlying JVM object with 2 arguments
and casts the result to TReturn.
TReturn Invoke<TReturn>(string methodName, object arg0, object arg1)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
Invoke<TReturn>(string, object, object, object)
Invokes an instance method on the underlying JVM object with 3 arguments
and casts the result to TReturn.
TReturn Invoke<TReturn>(string methodName, object arg0, object arg1, object arg2)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
Invoke<TReturn>(string, object, object, object, object)
Invokes an instance method on the underlying JVM object with 4 arguments
and casts the result to TReturn.
TReturn Invoke<TReturn>(string methodName, object arg0, object arg1, object arg2, object arg3)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
Invoke<TReturn>(string, object, object, object, object, object)
Invokes an instance method on the underlying JVM object with 5 arguments
and casts the result to TReturn.
TReturn Invoke<TReturn>(string methodName, object arg0, object arg1, object arg2, object arg3, object arg4)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
Invoke<TReturn>(string, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object with 6 arguments
and casts the result to TReturn.
TReturn Invoke<TReturn>(string methodName, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
Invoke<TReturn>(string, object, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object with 7 arguments
and casts the result to TReturn.
TReturn Invoke<TReturn>(string methodName, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
arg6objectThe seventh argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
Invoke<TReturn>(string, object, object, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object with 8 arguments
and casts the result to TReturn.
TReturn Invoke<TReturn>(string methodName, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
arg6objectThe seventh argument to pass to the method.
arg7objectThe eighth argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
Invoke<TReturn>(string, object, object, object, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object with 9 arguments
and casts the result to TReturn.
TReturn Invoke<TReturn>(string methodName, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
arg6objectThe seventh argument to pass to the method.
arg7objectThe eighth argument to pass to the method.
arg8objectThe ninth argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
Invoke<TReturn>(string, object, object, object, object, object, object, object, object, object, object)
Invokes an instance method on the underlying JVM object with 10 arguments
and casts the result to TReturn.
TReturn Invoke<TReturn>(string methodName, object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9)
Parameters
methodNamestringThe name of the Java instance method to invoke.
arg0objectThe first argument to pass to the method.
arg1objectThe second argument to pass to the method.
arg2objectThe third argument to pass to the method.
arg3objectThe fourth argument to pass to the method.
arg4objectThe fifth argument to pass to the method.
arg5objectThe sixth argument to pass to the method.
arg6objectThe seventh argument to pass to the method.
arg7objectThe eighth argument to pass to the method.
arg8objectThe ninth argument to pass to the method.
arg9objectThe tenth argument to pass to the method.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types, Enum, and arrays of primitive types.
Exceptions
- MissingMethodException
Thrown if no matching method is found for the given argument types.
- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
Invoke<TReturn>(string, params object[])
Invokes an instance method on the underlying JVM object using a variable-length argument list
and casts the result to TReturn.
The bridge resolves the target Java method by matching the runtime types of the supplied arguments.
TReturn Invoke<TReturn>(string methodName, params object[] args)
Parameters
methodNamestringThe name of the Java instance method to invoke.
argsobject[]The arguments to pass to the method. Each element must be a type compatible with the corresponding Java parameter: primitive types, IJavaObject instances, or .NET arrays of primitive types.
Returns
- TReturn
The return value of the method cast to
TReturn.
Type Parameters
TReturnThe expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types (int, long, bool, etc.), Enum, and arrays of primitive types.
Remarks
Use this overload when the number of arguments is not known at compile time. For a fixed, known number of arguments (0–10), prefer the strongly-typed overloads to avoid the overhead of array allocation.
Exceptions
- MissingMethodException
Thrown if no method matching
methodNamewith the inferred signature is found.- InvalidCastException
Thrown if the actual return value cannot be cast to
TReturn.
SetField(string, object)
Writes a value to an instance field on the underlying JVM object.
void SetField(string fieldName, object val)
Parameters
fieldNamestringThe name of the Java instance field to write.
valobjectThe value to assign. Must be compatible with the Java field's declared type: boxed .NET primitives, IJavaObject instances, or arrays of primitive types.
Exceptions
- InvalidOperationException
Thrown if no field named
fieldNameis found on the underlying Java class.- InvalidCastException
Thrown if
valis not assignable to the Java field's declared type.
ToJavaArray()
Reinterprets this IJavaObject as an IJavaArray reference.
IJavaArray ToJavaArray()
Returns
- IJavaArray
An IJavaArray wrapping the same JVM object reference.
Remarks
This conversion is valid only when the underlying JVM object is a Java array instance. Use this method to obtain a typed array view that enables element-level access via the IJavaArray API. Do not Dispose() this instance while the retuned IJavaArray is still in use
Exceptions
- InvalidCastException
Thrown if the underlying JVM object is not a Java array.