io.sarl.lang.core.scoping.extensions.cast
Class PrimitiveCastExtensions
final class PrimitiveCastExtensions
extends java.lang.Object
Provide static functions related to the casting of primitives that are not numbers.
Maven Group Identifier:
io.sarl.lang
Maven Artifact Identifier:
core
Since:
0.9
Action Summary
Modifier and type Action and description
static boolean booleanValue(CharSequence)
Convert the given value to boolean.
static boolean booleanValue(Object)
Convert an Object to a primitive boolean.
static boolean booleanValue(AtomicBoolean)
Convert the given value to AtomicBoolean into its boolean value.
static byte byteValue(CharSequence)
Decodes a CharSequence into a byte.
static byte byteValue(Object)
Convert an Object to a primitive byte.
static char charValue(CharSequence)
Decodes a CharSequence into a char.
static char charValue(Object)
Convert an Object to a primitive char.
static double doubleValue(CharSequence)
Decodes a CharSequence into a double.
static double doubleValue(Object)
Convert an Object to a primitive double.
static float floatValue(CharSequence)
Decodes a CharSequence into a float.
static float floatValue(Object)
Convert an Object to a primitive float.
static int intValue(CharSequence)
Decodes a CharSequence into an int.
static int intValue(Object)
Convert an Object to a primitive int.
static long longValue(CharSequence)
Decodes a CharSequence into a long.
static long longValue(Object)
Convert an Object to a primitive long.
static short shortValue(CharSequence)
Decodes a CharSequence into a short.
static short shortValue(Object)
Convert an Object to a primitive short.
static java.util.concurrent.atomic.AtomicBoolean toAtomicBoolean(boolean)
Convert the given boolean to its equivalent AtomicBoolean.
static java.util.concurrent.atomic.AtomicBoolean toAtomicBoolean(CharSequence)
Decodes a CharSequence into a AtomicBoolean.
static java.util.concurrent.atomic.AtomicBoolean toAtomicBoolean(Object)
Convert an Object to an atomic boolean.
static com.google.common.util.concurrent.AtomicDouble toAtomicDouble(CharSequence)
Decodes a CharSequence into a AtomicDouble.
static com.google.common.util.concurrent.AtomicDouble toAtomicDouble(Object)
Convert an Object to an atomic double.
static java.util.concurrent.atomic.AtomicInteger toAtomicInteger(CharSequence)
Decodes a CharSequence into a AtomicInteger.
static java.util.concurrent.atomic.AtomicInteger toAtomicInteger(Object)
Convert an Object to an atomic integer.
static java.util.concurrent.atomic.AtomicLong toAtomicLong(CharSequence)
Decodes a CharSequence into a AtomicLong.
static java.util.concurrent.atomic.AtomicLong toAtomicLong(Object)
Convert an Object to an atomic long.
static java.math.BigDecimal toBigDecimal(CharSequence)
Decodes a CharSequence into a BigDecimal.
static java.math.BigDecimal toBigDecimal(Object)
Convert an Object to a big decimal.
static java.math.BigInteger toBigInteger(CharSequence)
Decodes a CharSequence into a BigInteger.
static java.math.BigInteger toBigInteger(Object)
Convert an Object to a big integer.
static byte toByte(CharSequence)
Decodes a CharSequence into a Byte.
static java.lang.Byte toByte(Object)
Convert an Object to a Byte.
static java.lang.Character toCharacter(CharSequence)
Decodes a CharSequence into a Character.
static java.lang.Character toCharacter(Object)
Convert an Object to a Character.
static java.lang.Double toDouble(CharSequence)
Decodes a CharSequence into a Double.
static java.lang.Double toDouble(Object)
Convert an Object to a Double.
static java.lang.Float toFloat(CharSequence)
Decodes a CharSequence into a Float.
static java.lang.Float toFloat(Object)
Convert an Object to a Float.
static java.lang.Integer toInteger(CharSequence)
Decodes a CharSequence into an Integer.
static java.lang.Integer toInteger(Object)
Convert an Object to a Integer.
static java.lang.Long toLong(CharSequence)
Decodes a CharSequence into a Long.
static java.lang.Long toLong(Object)
Convert an Object to a Long.
static java.lang.Short toShort(CharSequence)
Decodes a CharSequence into a Short.
static java.lang.Short toShort(Object)
Convert an Object to a Short.
static java.lang.String toString(boolean)
Convert the given value to String.
static java.lang.String toString(char)
Convert the given value to String.
static java.util.UUID toUUID(CharSequence)
Decodes a CharSequence into a UUID.
static java.util.UUID toUUID(Object)
Convert an Object to a UUID.
Action Details
booleanValue(CharSequence)
def booleanValue(CharSequence) : boolean
Convert the given value to boolean.

See decode(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of boolean type.
booleanValue(Object)
def booleanValue(Object) : boolean
Convert an Object to a primitive boolean.

If the given object is a boolean, the boolean value is replied. Otherwise, the given value is converted to String and then to boolean.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of boolean type.
Since:
0.13
booleanValue(AtomicBoolean)
def booleanValue(AtomicBoolean) : boolean
Convert the given value to AtomicBoolean into its boolean value.

See decode(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of boolean type.
Since:
0.12
byteValue(CharSequence)
def byteValue(CharSequence) : byte
Decodes a CharSequence into a byte.

In opposite to the functions of Byte, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See decode(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of byte type.
Since:
0.9
See:
decode(String)
byteValue(Object)
def byteValue(Object) : byte
Convert an Object to a primitive byte.

If the given object is a number, the byte value is replied. Otherwise, the given value is converted to String and then to byte.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of byte type.
Since:
0.13
charValue(CharSequence)
def charValue(CharSequence) : char
Decodes a CharSequence into a char.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of char type.
Since:
0.12
charValue(Object)
def charValue(Object) : char
Convert an Object to a primitive char.

If the given object is a character, the char value is replied. Otherwise, the given value is converted to String and then to char.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of char type.
Since:
0.13
doubleValue(CharSequence)
def doubleValue(CharSequence) : double
Decodes a CharSequence into a double.

In opposite to the functions of Double, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See valueOf(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of double type.
Since:
0.9
See:
valueOf(String)
doubleValue(Object)
def doubleValue(Object) : double
Convert an Object to a primitive double.

If the given object is a number, the double value is replied. Otherwise, the given value is converted to String and then to double.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of double type.
Since:
0.13
floatValue(CharSequence)
def floatValue(CharSequence) : float
Decodes a CharSequence into a float.

In opposite to the functions of Float, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See valueOf(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of float type.
Since:
0.9
See:
valueOf(String)
floatValue(Object)
def floatValue(Object) : float
Convert an Object to a primitive float.

If the given object is a number, the float value is replied. Otherwise, the given value is converted to String and then to float.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of float type.
Since:
0.13
intValue(CharSequence)
def intValue(CharSequence) : int
Decodes a CharSequence into an int.

In opposite to the functions of Integer, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See decode(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of int type.
Since:
0.9
See:
decode(String)
intValue(Object)
def intValue(Object) : int
Convert an Object to a primitive int.

If the given object is a number, the int value is replied. Otherwise, the given value is converted to String and then to int.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of int type.
Since:
0.13
longValue(CharSequence)
def longValue(CharSequence) : long
Decodes a CharSequence into a long.

In opposite to the functions of Long, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See decode(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of long type.
Since:
0.9
See:
decode(String)
longValue(Object)
def longValue(Object) : long
Convert an Object to a primitive long.

If the given object is a number, the long value is replied. Otherwise, the given value is converted to String and then to long.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of long type.
Since:
0.13
shortValue(CharSequence)
def shortValue(CharSequence) : short
Decodes a CharSequence into a short.

In opposite to the functions of Short, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See decode(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of short type.
Since:
0.9
See:
decode(String)
shortValue(Object)
def shortValue(Object) : short
Convert an Object to a primitive short.

If the given object is a number, the short value is replied. Otherwise, the given value is converted to String and then to short.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of short type.
Since:
0.13
toAtomicBoolean(boolean)
def toAtomicBoolean(boolean) : java.util.concurrent.atomic.AtomicBoolean
Convert the given boolean to its equivalent AtomicBoolean.
Parameters:
value - a value to convert.
Returns:
the equivalent value to value of AtomicBoolean type.
Since:
0.12
toAtomicBoolean(CharSequence)
def toAtomicBoolean(CharSequence) : java.util.concurrent.atomic.AtomicBoolean
Decodes a CharSequence into a AtomicBoolean.

See decode(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of AtomicBoolean type.
Since:
0.12
See:
booleanValue(CharSequence)
toAtomicBoolean(Object)
def toAtomicBoolean(Object) : java.util.concurrent.atomic.AtomicBoolean
Convert an Object to an atomic boolean.

If the given object is a boolean, the boolean value is replied. Otherwise, the given value is converted to String and then to boolean.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of boolean type.
Since:
0.13
toAtomicDouble(CharSequence)
def toAtomicDouble(CharSequence) : com.google.common.util.concurrent.AtomicDouble
Decodes a CharSequence into a AtomicDouble.

In opposite to the functions of Double, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See doubleValue(CharSequence) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of AtomicDouble type.
Since:
0.9
See:
doubleValue(CharSequence)
toAtomicDouble(Object)
def toAtomicDouble(Object) : com.google.common.util.concurrent.AtomicDouble
Convert an Object to an atomic double.

If the given object is a number, the double value is replied. Otherwise, the given value is converted to String and then to double.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of double type.
Since:
0.13
toAtomicInteger(CharSequence)
def toAtomicInteger(CharSequence) : java.util.concurrent.atomic.AtomicInteger
Decodes a CharSequence into a AtomicInteger.

In opposite to the functions of Integer, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See intValue(CharSequence) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of AtomicInteger type.
Since:
0.9
See:
intValue(CharSequence)
toAtomicInteger(Object)
def toAtomicInteger(Object) : java.util.concurrent.atomic.AtomicInteger
Convert an Object to an atomic integer.

If the given object is a number, the int value is replied. Otherwise, the given value is converted to String and then to int.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of int type.
Since:
0.13
toAtomicLong(CharSequence)
def toAtomicLong(CharSequence) : java.util.concurrent.atomic.AtomicLong
Decodes a CharSequence into a AtomicLong.

In opposite to the functions of Long, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See longValue(CharSequence) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of AtomicLong type.
Since:
0.9
See:
longValue(CharSequence)
toAtomicLong(Object)
def toAtomicLong(Object) : java.util.concurrent.atomic.AtomicLong
Convert an Object to an atomic long.

If the given object is a number, the long value is replied. Otherwise, the given value is converted to String and then to long.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of long type.
Since:
0.13
toBigDecimal(CharSequence)
def toBigDecimal(CharSequence) : java.math.BigDecimal
Decodes a CharSequence into a BigDecimal.

In opposite to the functions of Double, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See BigDecimal(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of BigInteger type.
Since:
0.9
See:
intValue(CharSequence)
toBigDecimal(Object)
def toBigDecimal(Object) : java.math.BigDecimal
Convert an Object to a big decimal.

If the given object is a number, the double value is replied. Otherwise, the given value is converted to String and then to double.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of BigDecimal type.
Since:
0.13
toBigInteger(CharSequence)
def toBigInteger(CharSequence) : java.math.BigInteger
Decodes a CharSequence into a BigInteger.

In opposite to the functions of Integer, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See BigInteger(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of BigInteger type.
Since:
0.9
See:
intValue(CharSequence)
toBigInteger(Object)
def toBigInteger(Object) : java.math.BigInteger
Convert an Object to a big integer.

If the given object is a number, the long value is replied. Otherwise, the given value is converted to String and then to long.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of BigInteger type.
Since:
0.13
toByte(CharSequence)
def toByte(CharSequence) : byte
Decodes a CharSequence into a Byte.

In opposite to the functions of Byte, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See decode(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of Byte type.
Since:
0.12
See:
decode(String)
toByte(Object)
def toByte(Object) : java.lang.Byte
Convert an Object to a Byte.

If the given object is a number, the byte value is replied. Otherwise, the given value is converted to String and then to byte.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of Byte type.
Since:
0.13
toCharacter(CharSequence)
def toCharacter(CharSequence) : java.lang.Character
Decodes a CharSequence into a Character.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of Character type.
Since:
0.12
toCharacter(Object)
def toCharacter(Object) : java.lang.Character
Convert an Object to a Character.

If the given object is a character, the value is replied. If the given object is a number, the int value converted to char is replied. Otherwise, the given value is converted to String and then to char.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of Character type.
Since:
0.13
toDouble(CharSequence)
def toDouble(CharSequence) : java.lang.Double
Decodes a CharSequence into a Double.

In opposite to the functions of Double, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See valueOf(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of Double type.
Since:
0.12
See:
valueOf(String)
toDouble(Object)
def toDouble(Object) : java.lang.Double
Convert an Object to a Double.

If the given object is a number, the double value is replied. Otherwise, the given value is converted to String and then to double.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of Double type.
Since:
0.13
toFloat(CharSequence)
def toFloat(CharSequence) : java.lang.Float
Decodes a CharSequence into a Float.

In opposite to the functions of Float, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See valueOf(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of Float type.
Since:
0.9
See:
valueOf(String)
toFloat(Object)
def toFloat(Object) : java.lang.Float
Convert an Object to a Float.

If the given object is a number, the float value is replied. Otherwise, the given value is converted to String and then to float.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of Float type.
Since:
0.13
toInteger(CharSequence)
def toInteger(CharSequence) : java.lang.Integer
Decodes a CharSequence into an Integer.

In opposite to the functions of Integer, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See decode(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of Integer type.
Since:
0.12
See:
decode(String)
toInteger(Object)
def toInteger(Object) : java.lang.Integer
Convert an Object to a Integer.

If the given object is a number, the int value is replied. Otherwise, the given value is converted to String and then to int.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of Integer type.
Since:
0.13
toLong(CharSequence)
def toLong(CharSequence) : java.lang.Long
Decodes a CharSequence into a Long.

In opposite to the functions of Long, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See decode(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of Long type.
Since:
0.9
See:
decode(String)
toLong(Object)
def toLong(Object) : java.lang.Long
Convert an Object to a Long.

If the given object is a number, the long value is replied. Otherwise, the given value is converted to String and then to long.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of Long type.
Since:
0.13
toShort(CharSequence)
def toShort(CharSequence) : java.lang.Short
Decodes a CharSequence into a Short.

In opposite to the functions of Short, this function is null-safe and does not generate a NumberFormatException. If the given string cannot by parsed, 0 is replied.

See decode(String) for details on the accepted formats for the input string of characters.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of Short type.
Since:
0.12
See:
decode(String)
toShort(Object)
def toShort(Object) : java.lang.Short
Convert an Object to a Short.

If the given object is a number, the short value is replied. Otherwise, the given value is converted to String and then to short.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of Short type.
Since:
0.13
toString(boolean)
def toString(boolean) : java.lang.String
Convert the given value to String.
Parameters:
value - a value of boolean type.
Returns:
the equivalent value to value of String type.
toString(char)
def toString(char) : java.lang.String
Convert the given value to String.
Parameters:
value - a value of char type.
Returns:
the equivalent value to value of String type.
toUUID(CharSequence)
def toUUID(CharSequence) : java.util.UUID
Decodes a CharSequence into a UUID.

In opposite to the functions of UUID, this function is null-safe and does not generate an exception. If the given string cannot by parsed, null is replied.
Parameters:
value - a value of CharSequence type.
Returns:
the equivalent value to value of UUID type, or null if a UUID cannot be parsed from the string of characters.
Since:
0.12
toUUID(Object)
def toUUID(Object) : java.util.UUID
Convert an Object to a UUID.

If the given object is a identifier, the value is replied. Otherwise, the given value is converted to String and then to identifier.
Parameters:
value - a value of Object type.
Returns:
the equivalent value to value of UUID type.
Since:
0.13