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():
SchemaType.AVRO,SchemaType.JSON,SchemaType.PROTOBUF_NATIVE: a structured record — usefields()andfield(String)to read its fields. A field value may itself be aGenericRecord(nested record).SchemaType.KEY_VALUE:fields()is empty andnativeObject()is aKeyValue.- any primitive type (e.g.
SchemaType.STRING,SchemaType.INT32):fields()is empty andnativeObject()is the primitive value.
-
Method Summary
Modifier and TypeMethodDescriptionGet the value of a field by name.default ObjectGet the value of a field.fields()The fields of this record, in declaration order.The underlying decoded value: aKeyValueforSchemaType.KEY_VALUE, a primitive for a primitive schema, or an implementation-specific native record for structured types.The schema type of the decoded value.
-
Method Details
-
schemaType
-
nativeObject
Object nativeObject()The underlying decoded value: aKeyValueforSchemaType.KEY_VALUE, a primitive for a primitive schema, or an implementation-specific native record for structured types.- Returns:
- the native object, or
null
-
fields
-
field
-
field
-