Here you can find the source of cast(Object o, String clazz)
public static <T> T cast(Object o, String clazz) throws ClassNotFoundException
//package com.java2s; //License from project: Apache License public class Main { public static <T> T cast(Object o, String clazz) throws ClassNotFoundException { return (T) Class.forName(clazz).cast(o); }/*w w w . j a va 2 s . c om*/ }