com.astamuse.asta4d.util.ClassUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of asta4d-core Show documentation
Show all versions of asta4d-core Show documentation
core functionalities of asta4d framework, including template and snippt implemention
package com.astamuse.asta4d.util;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class ClassUtil {
@SuppressWarnings("rawtypes")
public static final List retrieveAllFieldsIncludeAllSuperClasses(Class cls) {
Class c = cls;
List resultList = new LinkedList();
while (!c.getName().equals("java.lang.Object")) {
resultList.addAll(Arrays.asList(c.getDeclaredFields()));
c = c.getSuperclass();
}
return resultList;
}
}