@SuppressWarnings("unchecked")
        public I createImageByApplyingDelta(D delta) {
            try {
                try {
                    Method method = delta.getClass().getMethod("apply");
                    return (I) method.invoke(delta);
                } catch (NoSuchMethodException e) {
                    throw new RuntimeException(e);
                }
            } catch (InvocationTargetException e) {
                throw new RuntimeException(e.getCause());
            } catch (IllegalAccessException e) {
                throw new RuntimeException(e);
            }
        }
Replay a list of records.

@param target                The object to invoke the replay function on.
@param recordsAndVersions    A list of records.
metadata/src/test/java/org/apache/kafka/metadata/RecordTestUtils.java