private void generateClassEquals(String className, StructSpec struct,
                                     boolean elementKeysAreEqual) {
        buffer.printf("@Override%n");
        buffer.printf("public boolean %s(Object obj) {%n",
            elementKeysAreEqual ? "elementKeysAreEqual" : "equals");
        buffer.incrementIndent();
        buffer.printf("if (!(obj instanceof %s)) return false;%n", className);
        buffer.printf("%s other = (%s) obj;%n", className, className);
        if (!struct.fields().isEmpty()) {
            for (FieldSpec field : struct.fields()) {
                if (!elementKeysAreEqual || field.mapKey()) {
                    generateFieldEquals(field);
                }
            }
        }
        if (elementKeysAreEqual) {
            buffer.printf("return true;%n");
        } else {
            headerGenerator.addImport(MessageGenerator.MESSAGE_UTIL_CLASS);
            buffer.printf("return MessageUtil.compareRawTaggedFields(_unknownTaggedFields, " +
                "other._unknownTaggedFields);%n");
        }
        buffer.decrementIndent();
        buffer.printf("}%n");
    }
Generate the size calculator for a variable-length array element.
Array elements cannot be null.
generator/src/main/java/org/apache/kafka/message/MessageDataGenerator.java