fr.inria.ketuk
Class TypeConvertor

java.lang.Object
  |
  +--fr.inria.ketuk.TypeConvertor

public class TypeConvertor
extends java.lang.Object

A Collection of methods which convert an object of one type to one of another type.

Author:
Claude Pasquier

Method Summary
 java.lang.Object convert(java.lang.Boolean b, java.lang.Class target)
          Default convertor for an object of class Boolean
 java.lang.Object convert(java.lang.Number n, java.lang.Class target)
          Default convertor for an object of class Number
 java.lang.Object convert(java.lang.Object obj, java.lang.Class target)
          Default convertor for an object of class Object
 java.lang.Object convert(java.lang.String str, java.lang.Class target)
          Default convertor for an object of class String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

convert

public java.lang.Object convert(java.lang.Object obj,
                                java.lang.Class target)
                         throws java.lang.ClassCastException,
                                java.lang.NumberFormatException
Default convertor for an object of class Object
Parameters:
obj - the object to convert
target - the desired class
Returns:
a new object of the desired class

convert

public java.lang.Object convert(java.lang.String str,
                                java.lang.Class target)
                         throws java.lang.ClassCastException,
                                java.lang.NumberFormatException
Default convertor for an object of class String
Parameters:
str - the string to convert
target - the desired class
Returns:
a new object of the desired class

convert

public java.lang.Object convert(java.lang.Number n,
                                java.lang.Class target)
                         throws java.lang.ClassCastException,
                                java.lang.NumberFormatException
Default convertor for an object of class Number
Parameters:
n - the number to convert
target - the desired class
Returns:
a new object of the desired class

convert

public java.lang.Object convert(java.lang.Boolean b,
                                java.lang.Class target)
                         throws java.lang.ClassCastException,
                                java.lang.NumberFormatException
Default convertor for an object of class Boolean
Parameters:
b - the boolean to convert
target - the desired class
Returns:
a new object of the desired class