Represens a jni jobject

Introduced properties

fun delete_global_ref

jvm :: JavaObject :: delete_global_ref

Delete this global reference
fun delete_local_ref

jvm :: JavaObject :: delete_local_ref

Delete this local reference
fun is_java_null: Bool

jvm :: JavaObject :: is_java_null

Is self null in Java?
fun new_global_ref: SELF

jvm :: JavaObject :: new_global_ref

Returns a global reference to the Java object behind this reference
fun pop_from_local_frame: SELF

jvm :: JavaObject :: pop_from_local_frame

Pops the current local reference frame and return a valid reference to self
protected fun pop_from_local_frame_with_env(jni_env: JniEnv): SELF

jvm :: JavaObject :: pop_from_local_frame_with_env

Java implementation of pop_from_local_frame
fun to_java_string: JavaString

jvm :: JavaObject :: to_java_string

JavaString representation of self using Java's toString

Redefined properties

redef type SELF: JavaObject

jvm $ JavaObject :: SELF

Type of this instance, automatically specialized in every class
redef fun to_s: String

java :: ffi_support $ JavaObject :: to_s

Use Java's toString for any JavaObject

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
fun address_is_null: Bool

core :: Pointer :: address_is_null

Is the address behind this Object at NULL?
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun delete_global_ref

jvm :: JavaObject :: delete_global_ref

Delete this global reference
fun delete_local_ref

jvm :: JavaObject :: delete_local_ref

Delete this local reference
fun free

core :: Pointer :: free

Free the memory pointed by this pointer
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
fun is_java_null: Bool

jvm :: JavaObject :: is_java_null

Is self null in Java?
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
fun new_global_ref: SELF

jvm :: JavaObject :: new_global_ref

Returns a global reference to the Java object behind this reference
init nul: Pointer

core :: Pointer :: nul

C NULL pointer
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun pop_from_local_frame: SELF

jvm :: JavaObject :: pop_from_local_frame

Pops the current local reference frame and return a valid reference to self
protected fun pop_from_local_frame_with_env(jni_env: JniEnv): SELF

jvm :: JavaObject :: pop_from_local_frame_with_env

Java implementation of pop_from_local_frame
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
fun to_java_string: JavaString

jvm :: JavaObject :: to_java_string

JavaString representation of self using Java's toString
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
package_diagram jvm::JavaObject JavaObject core::Pointer Pointer jvm::JavaObject->core::Pointer core::Object Object core::Pointer->core::Object ...core::Object ... ...core::Object->core::Object jvm::JavaObject... ... jvm::JavaObject...->jvm::JavaObject

Ancestors

interface Object

core :: Object

The root of the class hierarchy.

Parents

extern class Pointer

core :: Pointer

Pointer classes are used to manipulate extern C structures.

Children

extern class AbstractJavaArray[E: Object]

java :: AbstractJavaArray

Java primitive array
extern class Android_app_Fragment

android :: Android_app_Fragment

Java class: android.app.Fragment
extern class Android_widget_Adapter

android :: Android_widget_Adapter

Java class: android.widget.Adapter
extern class Android_widget_Checkable

android :: Android_widget_Checkable

Java class: android.widget.Checkable
extern class JavaString

java :: JavaString

A standard Java string java.lang.String
extern class JavaThrowable

java :: JavaThrowable

Java class: java.lang.Throwable
extern class Java_nio_Buffer

java :: Java_nio_Buffer

Container for data of a specific primitive type
extern class NativeAssetFileDescriptor

android :: NativeAssetFileDescriptor

Android AssetFileDescriptor, can be retrieve by AssetManager and used to load a sound in a SoundPool
extern class NativeBundle

android :: NativeBundle

extern class NativeContext

android :: NativeContext

An Android activity context
extern class NativeFile

java :: NativeFile

extern class NativeHeadTracker

android :: NativeHeadTracker

Provides head tracking information from the device IMU
extern class NativeIntent

android :: NativeIntent

extern class NativeKeyEvent

android :: NativeKeyEvent

Java class: android.view.KeyEvent
extern class NativeScanResult

android :: NativeScanResult

Wraps Java class: android.net.wifi.ScanResult
extern class NativeView

android :: NativeView

A View for Android
extern class NativeWifiManager

android :: NativeWifiManager

Wraps Java class: android.net.wifi.WifiManager
extern class Vibrator

android :: Vibrator

Handle to an Android vibrator

Descendants

extern class Android_widget_AbsListView

android :: Android_widget_AbsListView

Java class: android.widget.AbsListView
extern class Android_widget_ArrayAdapter

android :: Android_widget_ArrayAdapter

Java class: android.widget.ArrayAdapter
extern class Android_widget_BaseAdapter

android :: Android_widget_BaseAdapter

Java class: android.widget.BaseAdapter
extern class Android_widget_CheckBox

android :: Android_widget_CheckBox

Java class: android.widget.CheckBox
extern class Android_widget_CompoundButton

android :: Android_widget_CompoundButton

Java abstract class: android.widget.CompoundButton
extern class Android_widget_ListAdapter

android :: Android_widget_ListAdapter

Java class: android.widget.ListAdapter
extern class Android_widget_ListView

android :: Android_widget_ListView

Java class: android.widget.ListView
extern class Android_widget_SpinnerAdapter

android :: Android_widget_SpinnerAdapter

Java class: android.widget.SpinnerAdapter
extern class JavaArray

java :: JavaArray

Java primitive array Object[]
extern class JavaBoolArray

java :: JavaBoolArray

Java primitive array boolean[]
extern class JavaByteArray

java :: JavaByteArray

Java primitive array byte[]
extern class JavaCharArray

java :: JavaCharArray

Java primitive array char[]
extern class JavaDoubleArray

java :: JavaDoubleArray

Java primitive array double[]
extern class JavaException

java :: JavaException

Java class: java.lang.Exception
extern class JavaFloatArray

java :: JavaFloatArray

Java primitive array float[]
extern class JavaIntArray

java :: JavaIntArray

Java primitive array int[]
extern class JavaLongArray

java :: JavaLongArray

Java primitive array long[]
extern class JavaShortArray

java :: JavaShortArray

Java primitive array short[]
extern class Java_nio_ByteBuffer

java :: Java_nio_ByteBuffer

A byte buffer
extern class NativeActivity

android :: NativeActivity

An activity, a single, focused thing a user can do on Android
extern class NativeButton

android :: NativeButton

extern class NativeContextWrapper

android :: NativeContextWrapper

A wrapper of context
extern class NativeGridLayout

android :: NativeGridLayout

A NativeViewGroup organized as a grid
extern class NativeLinearLayout

android :: NativeLinearLayout

A NativeViewGroup organized in a line
extern class NativeNativeActivity

android :: NativeNativeActivity

Android SDK's android.app.NativeActivity.
extern class NativeNitActivity

android :: NativeNitActivity

Wrapper to our Java NitActivity
extern class NativeService

android :: NativeService

Wrapper of Java class android.app.Service
extern class NativeViewGroup

android :: NativeViewGroup

A collection of NativeView

Class definitions

jvm $ JavaObject
# Represens a jni jobject
extern class JavaObject in "Java" `{ java.lang.Object `}
end
lib/jvm/jvm.nit:438,1--440,3

java :: ffi_support $ JavaObject
redef extern class JavaObject

	# Returns a global reference to the Java object behind this reference
	#
	# You must use a global reference when keeping a Java object
	# across execution of Java code, per JNI specification.
	fun new_global_ref: SELF import sys, Sys.jni_env `{
		Sys sys = JavaObject_sys(self);
		JNIEnv *env = Sys_jni_env(sys);
		return (*env)->NewGlobalRef(env, self);
	`}

	# Delete this global reference
	fun delete_global_ref import sys, Sys.jni_env `{
		Sys sys = JavaObject_sys(self);
		JNIEnv *env = Sys_jni_env(sys);
		(*env)->DeleteGlobalRef(env, self);
	`}

	# Delete this local reference
	fun delete_local_ref import sys, Sys.jni_env `{
		Sys sys = JavaObject_sys(self);
		JNIEnv *env = Sys_jni_env(sys);
		(*env)->DeleteLocalRef(env, self);
	`}

	# Pops the current local reference frame and return a valid reference to self
	#
	# Similar to `JavaVM::pop_local_frame` but returns a value.
	fun pop_from_local_frame: SELF
	do
		var jni_env = sys.jni_env
		return pop_from_local_frame_with_env(jni_env)
	end

	# Java implementation of `pop_from_local_frame`
	protected fun pop_from_local_frame_with_env(jni_env: JniEnv): SELF `{
		return (*jni_env)->PopLocalFrame(jni_env, self);
	`}

	# Is `self` null in Java?
	#
	# Since Java type system doesn't have the same `nullable` concept as Nit's,
	# the two systems are not directly compatible. Any Nit instances of
	# `JavaObject` may hold a Java null.
	#
	# To benefit from the safer type system of Nit, it is recommended to check
	# the return of all extern methods implemented in Java to ensure the value
	# is not a Java null. In case it is, you should replace it by a normal Nit
	# `null`.
	fun is_java_null: Bool in "Java" `{ return self == null; `}

	# `JavaString` representation of `self` using Java's `toString`
	fun to_java_string: JavaString in "Java" `{ return self.toString(); `}

	# Use Java's `toString` for any `JavaObject`
	redef fun to_s
	do
		if is_java_null then return "<{inspect_head}:null>"
		return to_java_string.to_s
	end
end
lib/java/ffi_support.nit:139,1--200,3

android :: http_request $ JavaObject
redef class JavaObject
	private fun is_exception: Bool in "Java" `{ return self instanceof Exception; `}
	private fun as_exception: JavaException in "Java" `{ return (Exception)self; `}

	private fun is_http_response: Bool in "Java" `{ return self instanceof HttpResponse; `}
	private fun as_http_response: JavaHttpResponse in "Java" `{ return (HttpResponse)self; `}
end
lib/android/http_request.nit:94,1--100,3