aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/config/gson/ExclusionUtils.java
blob: 462e2f58a947ae7f4f5b1804c24c35ec8ed4666d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package cc.polyfrost.oneconfig.config.gson;

public class ExclusionUtils {
    protected static boolean isSuperClassOf(Class<?> clazz, Class<?> parentClass) {
        Class<?> tempClass = clazz;
        Class<?> lastClass;
        if (tempClass == parentClass) return true;
        while (true) {
            lastClass = tempClass;
            if (tempClass == null) return false;
            tempClass = tempClass.getSuperclass();
            if (tempClass == null) return false;
            if (tempClass == lastClass) return false;
            if (tempClass == parentClass) return true;
        }
    }
}