Struct rust_jni::java::lang::Class [−][src]
pub struct Class<'env> { /* fields omitted */ }
A type representing a Java
Class
.
Methods
impl<'env> Class<'env>
[src]
impl<'env> Class<'env>
pub fn find<'a>(
env: &'a JniEnv<'a>,
class_name: &str,
token: &NoException<'a>
) -> JavaResult<'a, Class<'a>>
[src]
pub fn find<'a>(
env: &'a JniEnv<'a>,
class_name: &str,
token: &NoException<'a>
) -> JavaResult<'a, Class<'a>>
Find an existing Java class by it's name. The name is a fully qualified class or array type name.
pub fn define<'a>(
env: &'a JniEnv<'a>,
bytes: &[u8],
token: &NoException<'a>
) -> JavaResult<'a, Class<'a>>
[src]
pub fn define<'a>(
env: &'a JniEnv<'a>,
bytes: &[u8],
token: &NoException<'a>
) -> JavaResult<'a, Class<'a>>
Define a new Java class from a .class
file contents.
pub fn parent(&self, _token: &NoException) -> Option<Class<'env>>
[src]
pub fn parent(&self, _token: &NoException) -> Option<Class<'env>>
pub fn is_subtype_of(&self, class: &Class, _token: &NoException) -> bool
[src]
pub fn is_subtype_of(&self, class: &Class, _token: &NoException) -> bool
Check if this class is a subtype of the other class.
In Java a class is a subtype of the other class if that other class is a direct or an indirect parent of this class or an interface this class or any it's parent is implementing.
impl<'env> Class<'env>
[src]
impl<'env> Class<'env>
pub fn get_class(
env: &'env JniEnv<'env>,
token: &NoException<'env>
) -> JavaResult<'env, Class<'env>>
[src]
pub fn get_class(
env: &'env JniEnv<'env>,
token: &NoException<'env>
) -> JavaResult<'env, Class<'env>>
Get the Java class object for
Class
.
impl<'env> Class<'env>
[src]
impl<'env> Class<'env>
pub fn clone(&self, token: &NoException<'env>) -> JavaResult<'env, Self> where
Self: Sized,
[src]
pub fn clone(&self, token: &NoException<'env>) -> JavaResult<'env, Self> where
Self: Sized,
Clone the
Class
. This is not a deep clone of the Java object,
but a Rust-like clone of the value. Since Java objects are reference counted, this
will increment the reference count.
This method has a different signature from the one in the
Clone
trait
because cloning a Java object is only safe when there is no pending exception and
because cloning a java object cat throw an exception.
pub fn to_string(
&self,
token: &NoException<'env>
) -> JavaResult<'env, String<'env>>
[src]
pub fn to_string(
&self,
token: &NoException<'env>
) -> JavaResult<'env, String<'env>>
Convert the object to a string.
Methods from Deref<Target = Object<'env>>
pub unsafe fn raw_object(&self) -> jobject
[src]
pub unsafe fn raw_object(&self) -> jobject
Get the raw object pointer.
This function provides low-level access to the Java object and thus is unsafe.
pub fn env(&self) -> &'env JniEnv<'env>
[src]
pub fn env(&self) -> &'env JniEnv<'env>
Get the JniEnv
this object is bound to.
pub fn class(&self, _token: &NoException) -> Class<'env>
[src]
pub fn class(&self, _token: &NoException) -> Class<'env>
Get the object's class.
pub fn is_same_as(&self, other: &Object, _token: &NoException) -> bool
[src]
pub fn is_same_as(&self, other: &Object, _token: &NoException) -> bool
Compare with another Java object by reference.
pub fn is_instance_of(&self, class: &Class, _token: &NoException) -> bool
[src]
pub fn is_instance_of(&self, class: &Class, _token: &NoException) -> bool
Check if the object is an instance of the class.
pub fn clone(&self, token: &NoException<'env>) -> JavaResult<'env, Object<'env>>
[src]
pub fn clone(&self, token: &NoException<'env>) -> JavaResult<'env, Object<'env>>
Clone the Object
. This is not a deep clone of the Java object,
but a Rust-like clone of the value. Since Java objects are reference counted, this will
increment the reference count.
This method has a different signature from the one in the
Clone
trait because
cloning a Java object is only safe when there is no pending exception and because
cloning a java object cat throw an exception.
pub fn to_string(
&self,
token: &NoException<'env>
) -> JavaResult<'env, String<'env>>
[src]
pub fn to_string(
&self,
token: &NoException<'env>
) -> JavaResult<'env, String<'env>>
Convert the object to a string.
pub fn equals(
&self,
other: &Object,
token: &NoException<'env>
) -> JavaResult<'env, bool>
[src]
pub fn equals(
&self,
other: &Object,
token: &NoException<'env>
) -> JavaResult<'env, bool>
Compare to another Java object.
Trait Implementations
impl<'env> Debug for Class<'env>
[src]
impl<'env> Debug for Class<'env>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'a> JavaType for Class<'a>
[src]
impl<'a> JavaType for Class<'a>
impl<'env> Cast<'env, Class<'env>> for Class<'env>
[src]
impl<'env> Cast<'env, Class<'env>> for Class<'env>
Make
Class
castable to itself.
fn cast<'a>(&'a self) -> &'a Class<'env>
[src]
fn cast<'a>(&'a self) -> &'a Class<'env>
Cast the object to itself or one of it's superclasses. Read more
impl<'env> Eq for Class<'env>
[src]
impl<'env> Eq for Class<'env>
Allow comparing
Class
to Java objects. Java objects are compared by-reference to preserve
original Java semantics. To compare objects by value, call the
equals
method.
Will panic if there is a pending exception in the current thread.
This is mostly a convenience for using assert_eq!()
in tests. Always prefer using
is_same_as
to comparing with ==
, because
the former checks for a pending exception in compile-time rather than the run-time.
impl<'env> Deref for Class<'env>
[src]
impl<'env> Deref for Class<'env>
type Target = Object<'env>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
fn deref(&self) -> &Self::Target
Dereferences the value.
impl<'env> Cast<'env, Object<'env>> for Class<'env>
[src]
impl<'env> Cast<'env, Object<'env>> for Class<'env>
fn cast<'a>(&'a self) -> &'a Object<'env>
[src]
fn cast<'a>(&'a self) -> &'a Object<'env>
Cast the object to itself or one of it's superclasses. Read more
impl<'env, T> PartialEq<T> for Class<'env> where
T: Cast<'env, Object<'env>>,
[src]
impl<'env, T> PartialEq<T> for Class<'env> where
T: Cast<'env, Object<'env>>,
Allow comparing
Class
to Java objects. Java objects are compared by-reference to preserve
original Java semantics. To compare objects by value, call the
equals
method.
Will panic if there is a pending exception in the current thread.
This is mostly a convenience for using assert_eq!()
in tests. Always prefer using
is_same_as
to comparing with ==
, because
the former checks for a pending exception in compile-time rather than the run-time.
fn eq(&self, other: &T) -> bool
[src]
fn eq(&self, other: &T) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'env> Display for Class<'env>
[src]
impl<'env> Display for Class<'env>