Module JavaObject

module JavaObject: sig .. end
Utility functions for Java objects.


Instance creation

 
type t = java'lang'Object java_instance
The type of objects.
 
val make : unit -> t
Returns a new java.lang.Object instance.
 

Base methods

 
val equals : java'lang'Object java_extends ->
java'lang'Object java_extends -> java_boolean
equals this that tests whether this and that are equal; see equals(...).
Raises Java_exception if this is null
 
val get_class : java'lang'Object java_extends -> java'lang'Class java_instance
get_class obj returns the class of obj; see getClass(...).
Raises Java_exception if obj is null
 
val hash_code : java'lang'Object java_extends -> java_int
hash_code obj returns the hash code of obj; see hashCode(...).
Raises Java_exception if obj is null
 
val to_string : java'lang'Object java_extends -> JavaString.t
to_string obj returns the string representation of obj; see toString(...).
Raises Java_exception if obj is null
 

Synchronization

 
val notify : java'lang'Object java_extends -> unit
notify obj wakes up a thread waiting on the monitor of obj; see notify(...).
Raises
  • Java_exception if obj is null
  • Java_exception if the current thread does not hold the monitor
 
val notify_all : java'lang'Object java_extends -> unit
notify_all obj wakes up all the threads waiting on the monitor of obj; see notifyAll(...).
Raises
  • Java_exception if obj is null
  • Java_exception if the current thread does not hold the monitor
 
val wait : java'lang'Object java_extends -> unit
wait obj waits for a notification on the monitor of obj; see wait(...).
Raises
  • Java_exception if obj is null
  • Java_exception if the current thread does not hold the monitor
  • Java_exception if the thread is interrupted during wait
 
val wait_timeout : java'lang'Object java_extends -> java_long -> unit
wait_timeout obj ms waits for a notification on the monitor of obj, or a time of ms milliseconds has elapsed; see wait(...).
Raises
  • Java_exception if obj is null
  • Java_exception if the current thread does not hold the monitor
  • Java_exception if the thread is interrupted during wait
  • Java_exception if ms is negative
 
val wait_timeout_nanos : java'lang'Object java_extends -> java_long -> java_int -> unit
wait_timeout_nanos obj ms ns waits for a notification on the monitor of obj, or a time of to milliseconds and na nanoseconds has elapsed; see wait(...).
Raises
  • Java_exception if obj is null
  • Java_exception if the current thread does not hold the monitor
  • Java_exception if the thread is interrupted during wait
  • Java_exception if ms is negative
  • Java_exception if ns is not in the 0-999999 interval
 

Null value

 
val null : t
The null value.
 
val is_null : 'a java_instance -> bool
is_null obj returns true iff obj is equal to null.
 
val is_not_null : 'a java_instance -> bool
is_not_null obj returns false iff obj is equal to null.
 

Miscellaneous

 
val cast : java'lang'Object java_extends -> t
cast obj casts obj to a bare java.lang.Object instance.
 
val wrap : 'a java_instance -> 'a java_instance option
wrap obj wraps the reference obj into an option type:
  • Some x if obj is not null;
  • None if obj is null.

 
val unwrap : 'a java_instance option -> 'a java_instance
unwrap obj unwraps the option obj into a bare reference:
  • Some x is mapped to x;
  • None is mapped to null.