void generateNonDefaultValueCheck(HeaderGenerator headerGenerator,
                                      StructRegistry structRegistry,
                                      CodeBuffer buffer,
                                      String fieldPrefix,
                                      Versions nullableVersions) {
        String fieldDefault = fieldDefault(headerGenerator, structRegistry);
        if (type().isArray()) {
            if (fieldDefault.equals("null")) {
                buffer.printf("if (%s%s != null) {%n", fieldPrefix, camelCaseName());
            } else if (nullableVersions.empty()) {
                buffer.printf("if (!%s%s.isEmpty()) {%n", fieldPrefix, camelCaseName());
            } else {
                buffer.printf("if (%s%s == null || !%s%s.isEmpty()) {%n",
                    fieldPrefix, camelCaseName(), fieldPrefix, camelCaseName());
            }
        } else if (type().isBytes()) {
            if (fieldDefault.equals("null")) {
                buffer.printf("if (%s%s != null) {%n", fieldPrefix, camelCaseName());
            } else if (nullableVersions.empty()) {
                if (zeroCopy()) {
                    buffer.printf("if (%s%s.hasRemaining()) {%n",
                        fieldPrefix, camelCaseName());
                } else {
                    buffer.printf("if (%s%s.length != 0) {%n",
                        fieldPrefix, camelCaseName());
                }
            } else {
                if (zeroCopy()) {
                    buffer.printf("if (%s%s == null || %s%s.remaining() > 0) {%n",
                        fieldPrefix, camelCaseName(), fieldPrefix, camelCaseName());
                } else {
                    buffer.printf("if (%s%s == null || %s%s.length != 0) {%n",
                        fieldPrefix, camelCaseName(), fieldPrefix, camelCaseName());
                }
            }
        } else if (type().isString() || type().isStruct() || type() instanceof FieldType.UUIDFieldType) {
            if (fieldDefault.equals("null")) {
                buffer.printf("if (%s%s != null) {%n", fieldPrefix, camelCaseName());
            } else if (nullableVersions.empty()) {
                buffer.printf("if (!%s%s.equals(%s)) {%n",
                    fieldPrefix, camelCaseName(), fieldDefault);
            } else {
                buffer.printf("if (%s%s == null || !%s%s.equals(%s)) {%n",
                    fieldPrefix, camelCaseName(), fieldPrefix, camelCaseName(),
                    fieldDefault);
            }
        } else if (type() instanceof FieldType.BoolFieldType) {
            buffer.printf("if (%s%s%s) {%n",
                fieldDefault.equals("true") ? "!" : "",
                fieldPrefix, camelCaseName());
        } else {
            buffer.printf("if (%s%s != %s) {%n",
                fieldPrefix, camelCaseName(), fieldDefault);
        }
    }
Generate an if statement that checks if this field has a non-default value.

@param headerGenerator   The header generator in case we need to add imports.
@param structRegistry    The struct registry in case we need to look up structs.
@param buffer            The code buffer to write to.
@param fieldPrefix       The prefix to prepend before references to this field.
@param nullableVersions  The nullable versions to use for this field.  This is
                         mainly to let us choose to ignore the possibility of
                         nulls sometimes (like when dealing with array entries
                         that cannot be null).
generator/src/main/java/org/apache/kafka/message/FieldSpec.java