in kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/Reflector.java [95:126]
public static Object convert(Object ob, Class toType) throws ClassNotFoundException {
if (ob == null || ob.toString().equals("null")) {
return null;
}
if (toType == String.class) {
return new String(ob.toString());
} else if (toType == Byte.class || toType == byte.class) {
return new Byte(ob.toString());
} else if (toType == Character.class || toType == char.class) {
return new Character(ob.toString().charAt(0));
} else if (toType == Short.class || toType == short.class) {
return new Short(ob.toString());
} else if (toType == Integer.class || toType == int.class) {
return new Integer(ob.toString());
} else if (toType == Long.class || toType == long.class) {
return new Long(ob.toString());
} else if (toType == Double.class || toType == double.class) {
return new Double(ob.toString());
} else if (toType == Float.class || toType == float.class) {
return new Float(ob.toString());
} else if (toType == Boolean.class || toType == boolean.class) {
return new Boolean(
ob.toString().equals("true")
|| ob.toString().equals(true + "")
|| ob.toString().equals("1")
|| ob.toString().equals("on")
|| ob.toString().equals("yes"));
} else if (toType == Class.class) {
return Class.forName(ob.toString());
}
return null;
}