Skip to main content

JExceptionInInitializerError

Struct JExceptionInInitializerError 

Source
pub struct JExceptionInInitializerError<'local>(/* private fields */);
Expand description

A java.lang.ExceptionInInitializerError reference, tied to a JNI local reference frame.

See the JObject documentation for more information about object references, how to cast them, and local reference frame lifetimes.

Implementations§

Source§

impl<'local> JExceptionInInitializerError<'local>

Source

pub unsafe fn from_raw<'env_inner>( env: &Env<'env_inner>, raw: jobject, ) -> JExceptionInInitializerError<'env_inner>

Creates a JExceptionInInitializerError that wraps the given raw jobject

§Safety
  • raw must be a valid raw JNI local reference (or null).
  • raw must be an instance of the correct Java class.
  • There must not be any other owning Reference wrapper for the same reference.
  • The local reference must belong to the current thread and not outlive the JNI stack frame associated with the Env 'local lifetime.
Source

pub const fn null() -> JExceptionInInitializerError<'static>

Creates a new null reference.

Null references are always valid and do not belong to a local reference frame. Therefore, the returned JExceptionInInitializerError always has the 'static lifetime.

Source

pub fn into_raw(self) -> jobject

Unwrap to the raw jni type.

Source

pub fn cast_local<'any_local>( env: &mut Env<'_>, obj: impl Reference + Into<JObject<'any_local>> + AsRef<JObject<'any_local>>, ) -> Result<JExceptionInInitializerError<'any_local>>

Cast a local reference to a JExceptionInInitializerError

This will do a runtime (IsInstanceOf) check that the object is an instance of the correct class.

Also see these other options for casting local or global references to a JExceptionInInitializerError:

§Errors

Returns Error::WrongObjectType if the IsInstanceOf check fails.

Source§

impl<'local> JExceptionInInitializerError<'local>

Source

pub fn as_throwable(&self) -> Cast<'local, '_, JThrowable<'local>>

Casts this JExceptionInInitializerError to a ::jni::objects::JThrowable

This does not require a runtime type check since any JExceptionInInitializerError is also a ::jni::objects::JThrowable

Source§

impl JExceptionInInitializerError<'static>

Source

pub fn new_null<'env_local>( env: &mut Env<'env_local>, ) -> Result<JExceptionInInitializerError<'env_local>>

Construct without any message

Source

pub fn new<'env_local, 'local_0>( env: &mut Env<'env_local>, msg: impl AsRef<JString<'local_0>>, ) -> Result<JExceptionInInitializerError<'env_local>>

Construct with a message

Source

pub fn new_with_exception<'env_local, 'local_0>( env: &mut Env<'env_local>, cause: impl AsRef<JThrowable<'local_0>>, ) -> Result<JExceptionInInitializerError<'env_local>>

Construct with only an exception cause and a null message

Source§

impl<'local> JExceptionInInitializerError<'local>

Source

pub fn get_cause<'env_local>( &self, env: &mut Env<'env_local>, ) -> Result<JThrowable<'env_local>>

Returns the exception that was thrown during static initialization.

Source

pub fn get_exception<'env_local>( &self, env: &mut Env<'env_local>, ) -> Result<JThrowable<'env_local>>

Returns the exception that was thrown during static initialization.

Source§

impl<'local> JExceptionInInitializerError<'local>

Source

pub fn matches<'any, 'from>( env: &Env<'_>, throwable: &'from JThrowable<'any>, ) -> Result<Option<Cast<'any, 'from, JExceptionInInitializerError<'any>>>>

Checks if the given throwable is an instance of this exception type.

Returns Some(Cast<JExceptionInInitializerError>) if the throwable is an instance of this exception type or returns None if it is not.

Returns Error::NullPtr if the throwable is null.

Methods from Deref<Target = JObject<'local>>§

Source

pub fn as_raw(&self) -> jobject

Returns the raw JNI pointer.

Trait Implementations§

Source§

impl<'local> AsRef<JExceptionInInitializerError<'local>> for JExceptionInInitializerError<'local>

Source§

fn as_ref(&self) -> &JExceptionInInitializerError<'local>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'local> AsRef<JObject<'local>> for JExceptionInInitializerError<'local>

Source§

fn as_ref(&self) -> &JObject<'local>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'local> AsRef<JThrowable<'local>> for JExceptionInInitializerError<'local>

Source§

fn as_ref(&self) -> &JThrowable<'local>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'local> Debug for JExceptionInInitializerError<'local>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'local> Default for JExceptionInInitializerError<'local>

Source§

fn default() -> JExceptionInInitializerError<'local>

Returns the “default value” for a type. Read more
Source§

impl<'local> Deref for JExceptionInInitializerError<'local>

Source§

type Target = JObject<'local>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'local> From<JExceptionInInitializerError<'local>> for JObject<'local>

Source§

fn from(other: JExceptionInInitializerError<'local>) -> JObject<'local>

Converts to this type from the input type.
Source§

impl<'local> From<JExceptionInInitializerError<'local>> for JThrowable<'local>

Source§

fn from(value: JExceptionInInitializerError<'local>) -> JThrowable<'local>

Converts to this type from the input type.
Source§

impl<'local> Reference for JExceptionInInitializerError<'local>

Source§

type Kind<'env> = JExceptionInInitializerError<'env>

The generic associated Self::Kind type corresponds to the underlying class type (such as JObject or JString), parameterized by the lifetime that indicates whether the type holds a global reference ('static) or a local reference that’s tied to a JNI stack frame. Read more
Source§

type GlobalKind = JExceptionInInitializerError<'static>

The associated GlobalKind type should be equivalent to Kind<'static>, with the additional bound that ensures the type is Send + Sync Read more
Source§

fn as_raw(&self) -> jobject

Returns the underlying, raw crate::sys::jobject reference.
Source§

fn class_name() -> Cow<'static, JNIStr>

The fully qualified class name of the Java class represented by this reference. Read more
Source§

fn lookup_class<'caller>( env: &Env<'_>, loader_context: &LoaderContext<'_, '_>, ) -> Result<impl Deref<Target = Global<JClass<'static>>> + 'caller>

Looks up a global reference to the JClass associated with this reference. Read more
Source§

unsafe fn kind_from_raw<'env>(local_ref: jobject) -> Self::Kind<'env>

Returns a new reference type based on Self::Kind for the given reference that is tied to the specified lifetime. Read more
Source§

unsafe fn global_kind_from_raw(global_ref: jobject) -> Self::GlobalKind

Returns a ('static) reference type based on Self::GlobalKind for the given global_ref. Read more
Source§

fn is_null(&self) -> bool

Returns true if this is a null object reference
Source§

fn null<'any>() -> Self::Kind<'any>

Returns null reference based on Self::Kind

Auto Trait Implementations§

§

impl<'local> Freeze for JExceptionInInitializerError<'local>

§

impl<'local> RefUnwindSafe for JExceptionInInitializerError<'local>

§

impl<'local> Send for JExceptionInInitializerError<'local>
where 'local: 'static,

§

impl<'local> Sync for JExceptionInInitializerError<'local>
where 'local: 'static,

§

impl<'local> Unpin for JExceptionInInitializerError<'local>

§

impl<'local> UnsafeUnpin for JExceptionInInitializerError<'local>

§

impl<'local> UnwindSafe for JExceptionInInitializerError<'local>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<'local, T> Desc<'local, T> for T
where T: AsRef<T>,

Source§

type Output = T

The type that this Desc returns.
Source§

fn lookup(self, _: &mut Env<'local>) -> Result<T, Error>

Look up the concrete type from the JVM. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<'local, T> IntoAuto<'local> for T
where T: Into<JObject<'local>>,

Source§

fn auto(self) -> Auto<'local, Self>

Wraps the local reference type into an auto-delete Auto that will automatically delete the local reference when it is dropped
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.