Language

JniEnvironment.Types Class

Definition

Provides Java class lookup, type queries, and native method registration.

public static class JniEnvironment.Types
type JniEnvironment.Types = class
Inheritance
JniEnvironment.Types

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Methods

Name Description
DefineClass(String, JniObjectReference, IntPtr, Int32)

Defines a Java class from a caller-owned class-file buffer.

FindClass(ReadOnlySpan<Byte>)

Finds a Java class using a null-terminated UTF-8 class name span. Use with "java/lang/Object"u8 literals to avoid string marshalling overhead.

FindClass(String)

Finds a Java class with JNI lookup and a runtime-class-loader fallback.

GetJniTypeNameFromClass(JniObjectReference)

Gets the JNI type name represented by a Java class reference.

GetJniTypeNameFromInstance(JniObjectReference)

Gets the JNI name of an object's runtime Java type.

GetObjectClass(JniObjectReference)

Gets an object's runtime Java class.

GetSuperclass(JniObjectReference)

Gets the immediate superclass of a Java class.

GetTypeFromInstance(JniObjectReference)

Creates an owned type wrapper for an object's runtime Java class.

IsAssignableFrom(JniObjectReference, JniObjectReference)

Tests whether instances of one Java class can be assigned to another Java type.

IsInstanceOf(JniObjectReference, JniObjectReference)

Tests whether a Java object is an instance of a class or interface.

IsSameObject(JniObjectReference, JniObjectReference)

Compares Java object identity rather than JNI handle values.

RegisterNatives(JniObjectReference, JniNativeMethodRegistration[], Int32)

Registers a prefix of a managed native method registration array.

RegisterNatives(JniObjectReference, JniNativeMethodRegistration[])

Registers every entry in a managed native method registration array.

RegisterNatives(JniObjectReference, ReadOnlySpan<JniNativeMethod>)

Registers JNI native methods using blittable JniNativeMethod structs with raw function pointers and UTF-8 name/signature pointers. Calls the JNI RegisterNatives function directly without delegate marshaling.

TryFindClass(ReadOnlySpan<Byte>, JniObjectReference)

Tries to find a Java class using a null-terminated UTF-8 class name span. Returns true if the class was found, false otherwise.

TryFindClass(String, JniObjectReference)

Attempts to find a Java class with a runtime-class-loader fallback.

UnregisterNatives(JniObjectReference)

Removes the native method registrations from a Java class.

Applies to