private Object getFieldOrDefault(BoundField field) {
        Object value = this.values[field.index];
        if (value != null)
            return value;
        else if (field.def.hasDefaultValue)
            return field.def.defaultValue;
        else if (field.def.type.isNullable())
            return null;
        else
            throw new SchemaException("Missing value for field '" + field.def.name + "' which has no default value.");
    }
Return the value of the given pre-validated field, or if the value is missing return the default value.

@param field The field for which to get the default value
@throws SchemaException if the field has no value and has no default.
clients/src/main/java/org/apache/kafka/common/protocol/types/Struct.java