code: public static <S, D extends S> void copyFields(final S src, D dest) throws IllegalArgumentException {
  		Class<?> targetClass = src.getClass();
  
  		do {
  			Field[] fields = targetClass.getDeclaredFields();
  			for (Field field : fields) {
  				// Skip static fields:
  				if (Modifier.isStatic(field.getModifiers())) {
  					continue;
  				}
  				try {
  					if ((!Modifier.isPublic(field.getModifiers())
  					            || !Modifier.isPublic(field.getDeclaringClass().getModifiers())
  					            || Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) {
  						field.setAccessible(true);
  					}
  					Object srcValue = field.get(src);
  					field.set(dest, srcValue);
  				}
  				catch (IllegalAccessException ex) {
  					throw new IllegalStateException(
  					            "Shouldn't be illegal to access field '" + field.getName() + "': " + ex);
  				}
  			}
  			targetClass = targetClass.getSuperclass();
  		}
  		while (targetClass != null && targetClass != Object.class);
  	}
docs: Perform the copying of all fields from {@code src} to {@code dest}. The code was copied from
  {@code org.springframework.util.ReflectionUtils#shallowCopyFieldState(Object, Object)}.