Here you can find the source of isAssignable(Class clazz, Class toClass)
public static boolean isAssignable(Class clazz, Class toClass)
//package com.java2s; /*/*from w ww.ja v a2s .c om*/ * JFox - The most lightweight Java EE Application Server! * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn. * * JFox is licenced and re-distributable under GNU LGPL. */ import java.util.HashMap; import java.util.Map; public class Main { private static Map<String, Class> primitiveStringToClass = new HashMap<String, Class>(); public static boolean isAssignable(Class clazz, Class toClass) { if (clazz == null || toClass == null) { return false; } if (clazz.equals(toClass)) { return true; } Class newClazz = clazz; Class newToClass = toClass; if (clazz.isPrimitive()) { newClazz = primitiveStringToClass.get(clazz.getName()); } if (toClass.isPrimitive()) { newToClass = primitiveStringToClass.get(toClass.getName()); } return newToClass.isAssignableFrom(newClazz); } public static boolean isAssignable(Class[] classArray, Class[] toClassArray) { if (classArray == null || toClassArray == null) { return false; } if (classArray.length != toClassArray.length) { return false; } for (int i = 0; i < classArray.length; i++) { if (!isAssignable(classArray[i], toClassArray[i])) { return false; } } return true; } }