diff -r d154d6012cbe -r 39d154429f7a java/sql-dk/src/info/globalcode/sql/dk/Functions.java --- a/java/sql-dk/src/info/globalcode/sql/dk/Functions.java Sat Aug 15 11:52:38 2015 +0200 +++ b/java/sql-dk/src/info/globalcode/sql/dk/Functions.java Sat Aug 15 13:21:26 2015 +0200 @@ -24,9 +24,13 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; +import java.util.ArrayDeque; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.Deque; +import java.util.List; import java.util.Map; /** @@ -164,4 +168,21 @@ return result.toString(); } } + + /** + * @param

type of the last parent + * @param type of the examined class + * @param type examined class + * @param lastParent the last parent type to stop at + * @return list of types starting with type and ending with lastParent + */ + public static List> getClassHierarchy(Class type, Class

lastParent) { + List> hierarchy = new ArrayList<>(); + + for (Class current = type; current != null && lastParent.isAssignableFrom(current); current = current.getSuperclass()) { + hierarchy.add(current); + } + + return hierarchy; + } }