Previous Up Next

Module JavaInt

module JavaInt: sig .. end
Support for int type and Integer class.


Instance creation

type t = java'lang'Integer java_instance
The type of wrappers for integer values.
val min_value : java_int
The smallest value for integer values.
val max_value : java_int
The largest value for integer values.
val make : java_int -> t
Returns a new java.lang.Integer wrapper for the passed value.
val make_of_string : JavaString.t -> t
Returns a new java.lang.Integer corresponding to the passed string; see Integer(...) .
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_int -> java_int -> java_int
Compares the passed values.
val compare_to : t -> t -> java_int
Compares the passed values.
val to_string : java_int -> JavaString.t
Converts the passed integer into a string; see toString(...) .
val value_of : java_int -> t
Converts the passed bare integer into a integer wrapper; see valueOf(...) .
val parse_int : ?radix:java_int -> JavaString.t -> java_int
Converts the passed string into a integer wrapper, using the passed radix (defaulting to 10l); see parseInt(...) .
Raises Java_exception if the string is invalid
val decode : JavaString.t -> t
Converts the passed string into a integer 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 integer 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.

AltStyle によって変換されたページ (->オリジナル) /