Language

JniRuntime.ReflectionJniValueManager.CreatePeer Method

Definition

Finds and constructs a compatible managed wrapper for a Java object.

public override Java.Interop.IJavaPeerable? CreatePeer(ref Java.Interop.JniObjectReference reference, Java.Interop.JniObjectReferenceOptions transfer, Type? targetType);
override this.CreatePeer : JniObjectReference * Java.Interop.JniObjectReferenceOptions * Type -> Java.Interop.IJavaPeerable

Parameters

reference
JniObjectReference

The JNI reference whose Java type is checked before wrapper creation.

transfer
JniObjectReferenceOptions

Source-reference transfer options for activation.

targetType
Type

The requested peer type; null selects JavaObject.

Returns

The constructed replaceable peer, or null for a zero reference or incompatible Java type.

Remarks

Missing type mappings or activation constructors can throw instead of returning null.

Applies to