org.huihoo.jfox.ms.jms.message
Class FormatHelper

java.lang.Object
  extended byorg.huihoo.jfox.ms.jms.message.FormatHelper

public class FormatHelper
extends java.lang.Object

A simple format converter helper class in order to help convert an Objec t type as per the table listed below.

A value written as the row type can be read as the column type. | | boolean byte short char int long float double String byte[] |---------------------------------------------------------------------- |boolean | X X |byte | X X X X X |short | X X X X |char | X X |int | X X X |long | X X |float | X X X |double | X X |String | X X X X X X X X |byte[] | X |----------------------------------------------------------------------

Version:
Revision: 1.1 Date: 2002-12-08 20:22:11
Author:
Peter.Cheng

Constructor Summary
FormatHelper()
           
 
Method Summary
static boolean getBoolean(java.lang.Object value)
          Convert value to boolean
static byte getByte(java.lang.Object value)
          Convert value to byte
static byte[] getBytes(java.lang.Object value)
          Convert value to Bytes
static char getChar(java.lang.Object value)
          Convert value to char
static double getDouble(java.lang.Object value)
          Convert value to double
static float getFloat(java.lang.Object value)
          Convert value to float
static int getInt(java.lang.Object value)
          Convert value to int
static long getLong(java.lang.Object value)
          Convert value to long
static short getShort(java.lang.Object value)
          Convert value to short
static java.lang.String getString(java.lang.Object value)
          Convert value to String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormatHelper

public FormatHelper()
Method Detail

getBoolean

public static boolean getBoolean(java.lang.Object value)
                          throws javax.jms.MessageFormatException
Convert value to boolean

Parameters:
value -
Returns:
the converted boolean
Throws:
javax.jms.MessageFormatException - if the conversion is invalid

getByte

public static byte getByte(java.lang.Object value)
                    throws javax.jms.MessageFormatException
Convert value to byte

Parameters:
value -
Returns:
the converted byte
Throws:
javax.jms.MessageFormatException - if the conversion is invalid

getShort

public static short getShort(java.lang.Object value)
                      throws javax.jms.MessageFormatException
Convert value to short

Parameters:
value -
Returns:
the converted short
Throws:
javax.jms.MessageFormatException - if the conversion is invalid

getChar

public static char getChar(java.lang.Object value)
                    throws javax.jms.MessageFormatException
Convert value to char

Parameters:
value - the object to convert from
Returns:
the converted char
Throws:
javax.jms.MessageFormatException - if the conversion is invalid
java.lang.NullPointerException - if value is null

getInt

public static int getInt(java.lang.Object value)
                  throws javax.jms.MessageFormatException
Convert value to int

Parameters:
value -
Returns:
the converted int
Throws:
javax.jms.MessageFormatException - if the conversion is invalid
java.lang.NumberFormatException - if value is a String and the conversion is invalid

getLong

public static long getLong(java.lang.Object value)
                    throws javax.jms.MessageFormatException
Convert value to long

Parameters:
value -
Returns:
the converted long
Throws:
javax.jms.MessageFormatException - if the conversion is invalid
java.lang.NumberFormatException - if value is a String and the conversion is invalid

getFloat

public static float getFloat(java.lang.Object value)
                      throws javax.jms.MessageFormatException
Convert value to float

Parameters:
value -
Returns:
the converted float
Throws:
javax.jms.MessageFormatException - if the conversion is invalid
java.lang.NumberFormatException - if value is a String and the conversion is invalid

getDouble

public static double getDouble(java.lang.Object value)
                        throws javax.jms.MessageFormatException
Convert value to double

Parameters:
value - the object to convert from
Returns:
the converted double
Throws:
javax.jms.MessageFormatException - if the conversion is invalid
java.lang.NumberFormatException - if value is a String and the conversion is invalid

getString

public static java.lang.String getString(java.lang.Object value)
                                  throws javax.jms.MessageFormatException
Convert value to String

Parameters:
value - the object to convert from
Returns:
the converted String
Throws:
javax.jms.MessageFormatException - if the conversion is invalid

getBytes

public static byte[] getBytes(java.lang.Object value)
                       throws javax.jms.MessageFormatException
Convert value to Bytes

Parameters:
value - the object to convert from
Returns:
the converted bytes
Throws:
javax.jms.MessageFormatException - if the conversion invalid


Copyright © 2002-2003 Open Enterprise Foundation. All Rights Reserved.