Interface GenericRecord


public interface GenericRecord
A schema-less view over a decoded message value, used when the value's schema is discovered at runtime rather than known at compile time (see Schema.autoConsume()).

The shape of the value depends on schemaType():

  • Method Details

    • schemaType

      SchemaType schemaType()
      The schema type of the decoded value.
      Returns:
      the SchemaType
    • nativeObject

      Object nativeObject()
      The underlying decoded value: a KeyValue for SchemaType.KEY_VALUE, a primitive for a primitive schema, or an implementation-specific native record for structured types.
      Returns:
      the native object, or null
    • fields

      List<Field> fields()
      The fields of this record, in declaration order. Empty for non-record (primitive or key/value) values.
      Returns:
      the list of Fields
    • field

      Object field(String fieldName)
      Get the value of a field by name.
      Parameters:
      fieldName - the field name
      Returns:
      the field value, or null if absent
    • field

      default Object field(Field field)
      Get the value of a field.
      Parameters:
      field - the field
      Returns:
      the field value, or null if absent