org.objectweb.joram.shared.messages

Class ConversionHelper


public class ConversionHelper
extends java.lang.Object

The ConversionHelper class is used for converting values carried by messages into specified types, if possible.

Method Summary

static boolean
toBoolean(Object value)
Gets the boolean value of the given object.
static byte
toByte(Object value)
Gets the byte value of the given object.
static byte[]
toBytes(Object value)
Gets the bytes value of the given object.
static char
toChar(Object value)
Gets the char value of the given object.
static double
toDouble(Object value)
Gets the double value of the given object.
static float
toFloat(Object value)
Gets the float value of the given object.
static int
toInt(Object value)
Gets the int value of the given object.
static long
toLong(Object value)
Gets the long value of the given object.
static short
toShort(Object value)
Gets the short value of the given object.
static String
toString(Object value)
Gets the String value of the given object.

Method Details

toBoolean

public static boolean toBoolean(Object value)
            throws MessageValueException
Gets the boolean value of the given object.

Throws:
MessageValueException - If the given object can't be converted into a boolean value.


toByte

public static byte toByte(Object value)
            throws MessageValueException
Gets the byte value of the given object.

Throws:
MessageValueException - If the given object can't be converted into a byte value.


toBytes

public static byte[] toBytes(Object value)
            throws MessageValueException
Gets the bytes value of the given object.

Throws:
MessageValueException - If the given object can't be converted into a bytes array.


toChar

public static char toChar(Object value)
            throws MessageValueException
Gets the char value of the given object.

Throws:
MessageValueException - If the given object can't be converted into a char value.


toDouble

public static double toDouble(Object value)
            throws MessageValueException
Gets the double value of the given object.

Throws:
MessageValueException - If the given object can't be converted into a double value.


toFloat

public static float toFloat(Object value)
            throws MessageValueException
Gets the float value of the given object.

Throws:
MessageValueException - If the given object can't be converted into a float value.


toInt

public static int toInt(Object value)
            throws MessageValueException
Gets the int value of the given object.

Throws:
MessageValueException - If the given object can't be converted into an int value.


toLong

public static long toLong(Object value)
            throws MessageValueException
Gets the long value of the given object.

Throws:
MessageValueException - If the given object can't be converted into a long value.


toShort

public static short toShort(Object value)
            throws MessageValueException
Gets the short value of the given object.

Throws:
MessageValueException - If the given object can't be converted into a short value.


toString

public static String toString(Object value)
Gets the String value of the given object.


Copyright B) 2004 Scalagent - All rights reserved