com.github.dmgcodevil.jmspy.proxy.ReflectionUtils Maven / Gradle / Ivy
package com.github.dmgcodevil.jmspy.proxy;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Created by dmgcodevil on 11/14/2014.
*/
public final class ReflectionUtils {
private ReflectionUtils() {
}
public static List getAllFields(Class> type) {
List fields = new ArrayList<>();
return getAllFields(fields, type);
}
public static List getAllFields(List fields, Class> type) {
fields.addAll(Arrays.asList(type.getDeclaredFields()));
if (type.getSuperclass() != null) {
fields = getAllFields(fields, type.getSuperclass());
}
return fields;
}
}