Module JavaLong

module JavaLong: sig .. end
Support for long type and Long class.


Instance creation

 
type t = java'lang'Long java_instance
The type of wrappers for long values.
 
val min_value : java_long
The smallest value for long values.
 
val max_value : java_long
The largest value for long values.
 
val make : java_long -> t
Returns a new java.lang.Long wrapper for the passed value.
 
val make_of_string : JavaString.t -> t
Returns a new java.lang.Long corresponding to the passed string; see Long(...).
Raises Java_exception if the string is invalid
 

Operations

 
val byte_value : t -> java_byte
Returns the wrapped value, as a byte.
 
val double_value : t -> java_double
Returns the wrapped value, as a double.
 
val float_value : t -> java_float
Returns the wrapped value, as a float.
 
val int_value : t -> java_int
Returns the wrapped value, as an int.
 
val long_value : t -> java_long
Returns the wrapped value, as a long.
 
val short_value : t -> java_short
Returns the wrapped value, as a short.
 
val compare : java_long -> java_long -> java_int
Compares the passed values.
 
val compare_to : t -> t -> java_int
Compares the passed values.
 
val to_string : java_long -> JavaString.t
Converts the passed long into a string; see toString(...).
 
val value_of : java_long -> t
Converts the passed bare long into a long wrapper; see valueOf(...).
 
val parse_long : ?radix:java_int -> JavaString.t -> java_long
Converts the passed string into a long wrapper, using the passed radix (defaulting to 10l); see parseLong(...).
Raises Java_exception if the string is invalid
 
val decode : JavaString.t -> t
Converts the passed string into a long wrapper; see decode(...).
Raises Java_exception if the string is invalid
 
val value_of_string : ?radix:java_int -> JavaString.t -> t
Converts the passed string into a long wrapper, using the passed radix (defaulting to 10l); see valueOf(...).
Raises Java_exception if the string is invalid
 

Null value

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

Miscellaneous

 
val wrap : t -> t 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 : t option -> t
unwrap obj unwraps the option obj into a bare reference:
  • Some x is mapped to x;
  • None is mapped to null.