Language

JniRuntime.JniValueManager.GetPeer(JniObjectReference, Type) Method

Definition

Reuses a compatible mapped peer or creates one with Copy transfer options.

public Java.Interop.IJavaPeerable? GetPeer(Java.Interop.JniObjectReference reference, Type? targetType = default);
member this.GetPeer : Java.Interop.JniObjectReference * Type -> Java.Interop.IJavaPeerable

Parameters

reference
JniObjectReference

The Java object reference to wrap or look up.

targetType
Type

The optional managed peer type required for a reused mapping.

Returns

A compatible existing peer or the creation hook's result. A zero reference returns null; the creation hook can also return null for an incompatible Java object.

Remarks

The source reference is passed by value, and the creation hook receives Copy rather than a source-disposal option.

Applies to