1
2
3
4
5
6
7 package yawn.util;
8
9 /***
10 * This is yawn.util.MiscUtils, part of the yawn project.
11 *
12 * <p>$Id: MiscUtils.java,v 1.5 2005/04/20 18:55:19 supermarti Exp $</p>
13 *
14 * @author Luis Martí (luis dot marti at uc3m dot es)
15 * @version $Revision: 1.5 $
16 */
17 public class MiscUtils {
18
19 /***
20 * tests if a java.lang.Class instance is a superclass of other
21 *
22 * @param superClass
23 * the super class
24 * @param testClass
25 * the class to set for inheritance
26 * @return true if superClass is a superClass of testClass
27 */
28 public static boolean isSuperClass(Class superClass, Class testClass) {
29 if (testClass.getSuperclass() == null) {
30 return false;
31 }
32
33 if (testClass.getSuperclass().equals(superClass)) {
34 return true;
35 }
36
37 return isSuperClass(superClass, testClass.getSuperclass());
38 }
39
40 }