JniType Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Owns a global JNI class reference and provides member lookup and native method registration.
public sealed class JniType : IDisposable
type JniType = class
interface IDisposable
- Inheritance
-
JniType
- Implements
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.
Constructors
| Name | Description |
|---|---|
| JniType(JniObjectReference, JniObjectReferenceOptions) |
Creates an owned global class reference from an existing JNI reference. |
| JniType(ReadOnlySpan<Byte>) |
Creates a JniType from a null-terminated UTF-8 class name span.
Use with |
| JniType(String) |
Resolves a Java class and retains its own global reference. |
Properties
| Name | Description |
|---|---|
| Name |
Gets the JNI name of the represented Java type. |
| PeerReference |
Gets the class reference owned by this wrapper. |
Methods
| Name | Description |
|---|---|
| AllocObject() |
Allocates a Java object without invoking a constructor. |
| DefineClass(String, JniObjectReference, Byte[]) |
Defines a Java class from class-file bytes and wraps its class reference. |
| Dispose() |
Unregisters retained native callbacks and releases this wrapper's global class reference. |
| GetCachedConstructor(JniMethodInfo, ReadOnlySpan<Byte>) |
Gets a cached constructor identifier, looking it up when the cache is empty. |
| GetCachedConstructor(JniMethodInfo, String) |
Gets a cached constructor identifier, looking it up when the cache is empty. |
| GetCachedInstanceField(JniFieldInfo, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>) |
Gets a cached instance-field identifier, looking it up when the cache is empty. |
| GetCachedInstanceField(JniFieldInfo, String, String) |
Gets a cached instance-field identifier, looking it up when the cache is empty. |
| GetCachedInstanceMethod(JniMethodInfo, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>) |
Gets a cached instance-method identifier, looking it up when the cache is empty. |
| GetCachedInstanceMethod(JniMethodInfo, String, String) |
Gets a cached instance-method identifier, looking it up when the cache is empty. |
| GetCachedJniType(JniType, ReadOnlySpan<Byte>) |
Gets a cached Java class wrapper, initializing an empty cache when needed. |
| GetCachedJniType(JniType, String) |
Gets a cached Java class wrapper, initializing an empty cache when needed. |
| GetCachedStaticField(JniFieldInfo, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>) |
Gets a cached static-field identifier, looking it up when the cache is empty. |
| GetCachedStaticField(JniFieldInfo, String, String) |
Gets a cached static-field identifier, looking it up when the cache is empty. |
| GetCachedStaticMethod(JniMethodInfo, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>) |
Gets a cached static-method identifier, looking it up when the cache is empty. |
| GetCachedStaticMethod(JniMethodInfo, String, String) |
Gets a cached static-method identifier, looking it up when the cache is empty. |
| GetConstructor(ReadOnlySpan<Byte>) |
Looks up a constructor identifier for this Java class. |
| GetConstructor(String) |
Looks up a constructor identifier for this Java class. |
| GetInstanceField(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>) |
Looks up an instance-field identifier for this Java class. |
| GetInstanceField(String, String) |
Looks up an instance-field identifier for this Java class. |
| GetInstanceMethod(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>) |
Looks up an instance-method identifier for this Java class. |
| GetInstanceMethod(String, String) |
Looks up an instance-method identifier for this Java class. |
| GetStaticField(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>) |
Looks up a static-field identifier for this Java class. |
| GetStaticField(String, String) |
Looks up a static-field identifier for this Java class. |
| GetStaticMethod(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>) |
Looks up a static-method identifier for this Java class. |
| GetStaticMethod(String, String) |
Looks up a static-method identifier for this Java class. |
| GetSuperclass() |
Gets a wrapper for the Java superclass. |
| IsAssignableFrom(JniType) |
Determines whether values of another Java type can be assigned to this type. |
| IsInstanceOfType(JniObjectReference) |
Tests whether a referenced Java object can be assigned to this type. |
| NewObject(JniMethodInfo, JniArgumentValue*) |
Allocates a Java object and invokes the supplied constructor. |
| RegisterNativeMethods(JniNativeMethodRegistration[]) |
Registers managed delegates as native methods of this Java class. |
| RegisterWithRuntime() |
Adds this type to the runtime's cleanup tracking. |
| ToString() |
Returns a diagnostic description of the Java type and class reference. |
| TryParse(String, JniType) |
Attempts to resolve a Java class and wrap its class reference. |
| UnregisterNativeMethods() |
Removes the native method registrations from this Java class. |