class DataTypeUtilities {

    public static Object fromDouble(double value, Class<?> theClass)
    {
        Object o;
        if (Number.class.isAssignableFrom(theClass))
        {
            o = Double.valueOf(value);
        }
        else if (Date.class.isAssignableFrom(theClass))
        {
            o = new Date((long)value);
        }
        else if (TimeSpan.class.isAssignableFrom(theClass))
        {
            o = TimeSpan.get((long)value);
        }
        else if (String.class.isAssignableFrom(theClass))
        {
            o = String.valueOf(value);
        }
        else
        {
            throw new IllegalArgumentException(value + " can't be converted to an object");
        }
        return o;
    }

    private  DataTypeUtilities();

}