private static Object valueOfField(Object obj, String fieldName) {
        Class<?> clazz = obj.getClass();
        Field field = null;
        while (clazz != null) {
            for (Field declaredField : clazz.getDeclaredFields()) {
                if (fieldName.equals(declaredField.getName())) {
                    field = declaredField;
                    break;
                }
            }
            clazz = clazz.getSuperclass();
        }
        if (field != null) {
            if (!field.isAccessible()) {
                field.setAccessible(true);
            }
            try {
                return field.get(obj);
            } catch (Exception e) {
                // Ignored
            }
        }
        return null;
    }