Object

Struct Object 

Source
pub struct Object(/* private fields */);
Expand description

java.lang.Object

The bottom type for all java::Classes, as well as the target for java::Object casts.

Implementations§

Source§

impl Object

Source

pub fn is_instance_of<T>(&self, e: &mut Env<'_>) -> bool
where T: Type,

Is this object instanceof C?

Source

pub fn upcast_to<T>(self, e: &mut Env<'_>) -> T
where T: Object,

Shorthand for T::upcast(e, jobj)

Source

pub fn new_reference(&self, e: &mut Env<'_>) -> Self

Create a new global reference to the same object

Source

pub fn to_string(&self, e: &mut Env<'_>) -> String

Invoke String toString()

Source

pub fn equals(&self, e: &mut Env<'_>, other: &Object) -> bool

Invoke boolean equals(Object o)

Source

pub fn to_value<'a>(&self, e: &mut Env<'a>) -> JValueGen<JObject<'a>>

Convert an object reference to an owned local jvalue

Source

pub fn to_local<'a>(&self, e: &mut Env<'a>) -> JObject<'a>

Convert an object reference to an owned local jobject

Source

pub fn into_global(self) -> GlobalRef

Unwrap an object’s inner global reference

Source

pub fn from_value<'a, 'b>(e: &mut Env<'a>, jv: JValueGen<JObject<'b>>) -> Self
where 'a: 'b,

Convert an owned local jvalue to an object

Source

pub fn from_value_ref<'a, 'b, 'c>( e: &mut Env<'a>, jv: JValueGen<&'c JObject<'b>>, ) -> Self
where 'a: 'b, 'c: 'b,

Convert a borrowed local jvalue to an object

Source

pub fn from_local<'a, 'b, T>(e: &mut Env<'a>, t: T) -> Self
where T: AsRef<JObject<'b>>, 'a: 'b,

Convert a local jobject to an object

Source

pub fn from_global(t: GlobalRef) -> Self

Convert a global reference to an object

Source

pub fn as_value(&self) -> JValueGen<&JObject<'static>>

Convert an object reference to a borrowed local JValue

Source

pub fn as_local(&self) -> &JObject<'static>

Convert an object reference to an owned local JObject

Source

pub fn as_global(&self) -> &GlobalRef

Get a reference to this object’s inner GlobalRef

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

Source

pub fn as_raw(&self) -> *mut _jobject

Returns the raw JNI pointer.

Trait Implementations§

Source§

impl AsRef<JObject<'static>> for Object

Source§

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

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

impl Class for Object

Source§

const PATH: &'static str = "java/lang/Object"

The fully qualified java class path (slash-separated) Read more
Source§

impl Deref for Object

Source§

type Target = JObject<'static>

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl From<GlobalRef> for Object

Source§

fn from(value: GlobalRef) -> Self

Converts to this type from the input type.
Source§

impl From<Object> for GlobalRef

Source§

fn from(value: Object) -> Self

Converts to this type from the input type.
Source§

impl Object for Object

Source§

fn upcast(_: &mut Env<'_>, jobj: Object) -> Self

Try to interpret an object as Self
Source§

fn downcast(self, _: &mut Env<'_>) -> Object

Create an object reference from self
Source§

fn downcast_ref(&self, e: &mut Env<'_>) -> Object

Create an object reference from &self
Source§

fn upcast_value_ref<'e>(e: &mut Env<'e>, jv: JValue<'e, '_>) -> Self
where Self: Sized,

Try to interpret a JValue as Self
Source§

fn upcast_value<'e>(e: &mut Env<'e>, jv: JValueOwned<'e>) -> Self
where Self: Sized,

Try to interpret a JValueOwned as Self
Source§

fn downcast_value<'e>(self, e: &mut Env<'e>) -> JValueOwned<'e>
where Self: Sized,

Create a JValueOwned from self
Source§

fn yield_to_java(&self, e: &mut Env<'_>) -> jobject

Use this to yield ownership of a java::lang::Object to the JVM, for example when returning a jobject from a native function.

Auto Trait Implementations§

§

impl Freeze for Object

§

impl RefUnwindSafe for Object

§

impl Send for Object

§

impl Sync for Object

§

impl Unpin for Object

§

impl UnwindSafe for Object

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<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<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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<F, A, TF, T> Sequence<F, A, TF> for T

Source§

fn sequence<Ap>(self) -> <Ap as HKT1>::T<<F as HKT1>::T<A>>
where Self: Sized + Traversable<F, <Ap as HKT1>::T<A>, A, TF> + Foldable<F, <Ap as HKT1>::T<A>>, Ap: HKT1, <Ap as HKT1>::T<A>: Applicative<Ap, A> + ApplyOnce<Ap, A>, <Ap as HKT1>::T<TF>: Applicative<Ap, TF> + ApplyOnce<Ap, TF>, <Ap as HKT1>::T<<F as HKT1>::T<A>>: Applicative<Ap, <F as HKT1>::T<A>> + ApplyOnce<Ap, <F as HKT1>::T<A>>, F: HKT1<T<<Ap as HKT1>::T<A>> = Self>,

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.
Source§

impl<T> Type for T
where T: Class,

Source§

const SIG: Signature = const SIG: Signature = Signature::class(T::PATH);

The signature for this type
Source§

fn jni() -> JavaType

Get the jni rep of this type
Source§

fn is_type_of(e: &mut Env<'_>, o: &JObject<'_>) -> bool

Determines whether an object is an instance of this type
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V