I am trying to obtain a field's value via reflection:
for (Field field : entity.getClass().getDeclaredFields()) { log.info("[Field name] {} ", field); try { log.info("[Field value] {} ", field.get(entity)); } catch (Exception e) { log.error(e.getMessage()); } } } But I have this error:
cannot access a member of class com.model.Dog with modifiers "private"