public static Set<Field> getInheritedFields(final Class<?> clazz) { final Field[] fields = clazz.getDeclaredFields(); final Set<Field> declaredFieldSet = CollectionUtils.arrayToSet(fields); final Set<Field> ret = new HashSet<>(declaredFieldSet); Class<?> currentClass = clazz.getSuperclass(); while (currentClass != null) { final Field[] superFields = currentClass.getDeclaredFields(); for (Field superField : superFields) { if (!Modifier.isPrivate(superField.getModifiers()) && !Modifier.isStatic(superField.getModifiers()) && !containField(ret, superField)) { ret.add(superField); } } currentClass = currentClass.getSuperclass(); } ret.removeAll(declaredFieldSet); return ret; }
public static Set<Field> getHiddenFields(final Class<?> clazz) { final Field[] fields = clazz.getDeclaredFields(); final Set<Field> declaredFieldSet = CollectionUtils.arrayToSet(fields); final Set<Field> ret = new HashSet<>(); Class<?> currentClass = clazz.getSuperclass(); while (currentClass != null) { final Field[] superFields = currentClass.getDeclaredFields(); for (Field superField : superFields) { final Field match = getMatch(declaredFieldSet, superField); if (!Modifier.isPrivate(superField.getModifiers()) && !Modifier.isStatic(superField.getModifiers()) && match != null) { ret.add(match); } } currentClass = currentClass.getSuperclass(); } return ret; }
public static Set<Method> getOverriddenMethods(final Class<?> clazz) { final Method[] methods = clazz.getDeclaredMethods(); final Set<Method> declaredMethodSet = CollectionUtils.arrayToSet(methods); final Set<Method> ret = new HashSet<>(); Class<?> currentClass = clazz.getSuperclass(); while (currentClass != null) { final Method[] superclassMethods = currentClass.getDeclaredMethods(); for (Method superclassMethod : superclassMethods) { final Method match = getMatch(declaredMethodSet, superclassMethod, true); if (match != null) { ret.add(match); } } currentClass = currentClass.getSuperclass(); } return ret; }
public static Set<Method> getInheritedMethods(final Class<?> clazz) { final Method[] methods = clazz.getDeclaredMethods(); final Set<Method> declaredMethodSet = CollectionUtils.arrayToSet(methods); final Set<Method> ret = new HashSet<Method>(declaredMethodSet); Class<?> currentClass = clazz.getSuperclass(); while (currentClass != null) { final Method[] superMethods = currentClass.getDeclaredMethods(); for (Method superMethod : superMethods) { if (!Modifier.isPrivate(superMethod.getModifiers()) && !Modifier.isStatic(superMethod.getModifiers()) && !containMethod(ret, superMethod)) { ret.add(superMethod); } } currentClass = currentClass.getSuperclass(); } ret.removeAll(declaredMethodSet); return ret; }
public static Set<Field> getOwnFields(final Class<?> clazz) { final Field[] fields = clazz.getDeclaredFields(); final Set<Field> declaredFieldSet = CollectionUtils.arrayToSet(fields); final Set<Field> ret = new HashSet<>(); final Set<Field> inheritedFields = getInheritedFields(clazz); final Set<Field> overriddenFields = getHiddenFields(clazz); for (final Field declaredField : declaredFieldSet) { if (!containField(inheritedFields, declaredField) && !containField(overriddenFields, declaredField)) { ret.add(declaredField); } } return ret; }
public static Set<Method> getOwnMethods(final Class<?> clazz) { final Method[] methods = clazz.getDeclaredMethods(); final Set<Method> declaredMethodSet = CollectionUtils.arrayToSet(methods); final Set<Method> ret = new HashSet<>(); final Set<Method> inheritedMethods = getInheritedMethods(clazz); final Set<Method> overriddenMethods = getOverriddenMethods(clazz); for (final Method declaredMethod : declaredMethodSet) { if (!containMethod(inheritedMethods, declaredMethod) && !containMethod(overriddenMethods, declaredMethod)) { ret.add(declaredMethod); } } return ret; }
public static Set<Method> getOverriddenMethods(final Class<?> clazz) { final Method[] methods = clazz.getDeclaredMethods(); final Set<Method> declaredMethodSet = CollectionUtils.arrayToSet(methods); final Set<Method> ret = new HashSet<>(); Class<?> currentClass = clazz.getSuperclass(); while (currentClass != null) { final Method[] superclassMethods = currentClass.getDeclaredMethods(); for (Method superclassMethod : superclassMethods) { final Method match = getMatch(declaredMethodSet, superclassMethod, true); if (match != null) { ret.add(match); } } currentClass = currentClass.getSuperclass(); } return ret; }
public static Set<Field> getInheritedFields(final Class<?> clazz) { final Field[] fields = clazz.getDeclaredFields(); final Set<Field> declaredFieldSet = CollectionUtils.arrayToSet(fields); final Set<Field> ret = new HashSet<>(declaredFieldSet); Class<?> currentClass = clazz.getSuperclass(); while (currentClass != null) { final Field[] superFields = currentClass.getDeclaredFields(); for (Field superField : superFields) { if (!Modifier.isPrivate(superField.getModifiers()) && !Modifier.isStatic(superField.getModifiers()) && !containField(ret, superField)) { ret.add(superField); } } currentClass = currentClass.getSuperclass(); } ret.removeAll(declaredFieldSet); return ret; }
public static Set<Method> getInheritedMethods(final Class<?> clazz) { final Method[] methods = clazz.getDeclaredMethods(); final Set<Method> declaredMethodSet = CollectionUtils.arrayToSet(methods); final Set<Method> ret = new HashSet<Method>(declaredMethodSet); Class<?> currentClass = clazz.getSuperclass(); while (currentClass != null) { final Method[] superMethods = currentClass.getDeclaredMethods(); for (Method superMethod : superMethods) { if (!Modifier.isPrivate(superMethod.getModifiers()) && !Modifier.isStatic(superMethod.getModifiers()) && !containMethod(ret, superMethod)) { ret.add(superMethod); } } currentClass = currentClass.getSuperclass(); } ret.removeAll(declaredMethodSet); return ret; }
public static Set<Field> getHiddenFields(final Class<?> clazz) { final Field[] fields = clazz.getDeclaredFields(); final Set<Field> declaredFieldSet = CollectionUtils.arrayToSet(fields); final Set<Field> ret = new HashSet<>(); Class<?> currentClass = clazz.getSuperclass(); while (currentClass != null) { final Field[] superFields = currentClass.getDeclaredFields(); for (Field superField : superFields) { final Field match = getMatch(declaredFieldSet, superField); if (!Modifier.isPrivate(superField.getModifiers()) && !Modifier.isStatic(superField.getModifiers()) && match != null) { ret.add(match); } } currentClass = currentClass.getSuperclass(); } return ret; }
public static Set<Field> getOwnFields(final Class<?> clazz) { final Field[] fields = clazz.getDeclaredFields(); final Set<Field> declaredFieldSet = CollectionUtils.arrayToSet(fields); final Set<Field> ret = new HashSet<>(); final Set<Field> inheritedFields = getInheritedFields(clazz); final Set<Field> overriddenFields = getHiddenFields(clazz); for (final Field declaredField : declaredFieldSet) { if (!containField(inheritedFields, declaredField) && !containField(overriddenFields, declaredField)) { ret.add(declaredField); } } return ret; }
public static Set<Method> getOwnMethods(final Class<?> clazz) { final Method[] methods = clazz.getDeclaredMethods(); final Set<Method> declaredMethodSet = CollectionUtils.arrayToSet(methods); final Set<Method> ret = new HashSet<>(); final Set<Method> inheritedMethods = getInheritedMethods(clazz); final Set<Method> overriddenMethods = getOverriddenMethods(clazz); for (final Method declaredMethod : declaredMethodSet) { if (!containMethod(inheritedMethods, declaredMethod) && !containMethod(overriddenMethods, declaredMethod)) { ret.add(declaredMethod); } } return ret; }