Click or drag to resize

IJavaObjectInvokeTReturn(String, Object) Method

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.

Namespace: MASES.JCOBridge.C2JBridge.JVMInterop
Assembly: C2JBridge (in C2JBridge.dll) Version: 2.6.9.260611-9a148513a79c26cdd7f1dde468f4f9e06ef3bc7e
Syntax
TReturn Invoke<TReturn>(
	string methodName,
	params Object[] args
)

Parameters

methodName  String
The name of the Java instance method to invoke.
args  Object
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.

Type Parameters

TReturn
The expected return type. Supported types: IJavaObject or any derived interface/class, .NET primitive types (Int32, Int64, Boolean, etc.), Enum, and arrays of primitive types.

Return Value

TReturn
The return value of the method cast to TReturn.
Exceptions
ExceptionCondition
MissingMethodException Thrown if no method matching methodName with the inferred signature is found.
InvalidCastException Thrown if the actual return value cannot be cast to TReturn.
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.
See Also