private static void calculateDifferences(ModelDiff diff) {
        Class<?> modelClass = diff.getBefore().getClass();
        for (Field field : modelClass.getDeclaredFields()) {
            if (field.getName().equals(ModelUtils.MODEL_TAIL_FIELD_NAME)) {
                continue;
            }
            try {
                Object before = FieldUtils.readField(field, diff.getBefore(), true);
                Object after = FieldUtils.readField(field, diff.getAfter(), true);
                if (!Objects.equal(before, after)) {
                    diff.addDifference(field, before, after);
                }
            } catch (IllegalAccessException e) {
                LOGGER.warn("Skipped field '{}' because of illegal access to it", field.getName(), e);
            }
        }
    }
private static void calculateDifferences ( ModelDiff diff ) { Class < ? > modelClass = diff . getBefore ( ) . getClass ( ) ; for ( Field field : modelClass . getDeclaredFields ( ) ) { if ( field . getName ( ) . equals ( ModelUtils . MODEL_TAIL_FIELD_NAME ) ) { continue ; } try { Object before = FieldUtils . readField ( field , diff . getBefore ( ) , true ) ; Object after = FieldUtils . readField ( field , diff . getAfter ( ) , true ) ; if ( ! Objects . equal ( before , after ) ) { diff . addDifference ( field , before , after ) ; } } catch ( IllegalAccessException e ) { LOGGER . warn ( "Skipped field '{}' because of illegal access to it" , field . getName ( ) , e ) ; } } }
Calculates the real differences between the two models of the given ModelDiff and saves them to the differences
field of the ModelDiff class.