Interface GenericRecord
-
- All Superinterfaces:
GenericObject
@Public @Stable public interface GenericRecord extends GenericObject
An interface represents a message with schema.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.ObjectgetField(java.lang.String fieldName)Retrieve the value of the provided fieldName.default java.lang.ObjectgetField(Field field)Retrieve the value of the provided field.java.util.List<Field>getFields()Returns the list of fields associated with the record.default java.lang.ObjectgetNativeObject()Return the internal native representation of the Record, like a AVRO GenericRecord.default SchemaTypegetSchemaType()Return the schema tyoe.byte[]getSchemaVersion()Return schema version.
-
-
-
Method Detail
-
getSchemaVersion
byte[] getSchemaVersion()
Return schema version.- Returns:
- schema version, or null if the information is not available.
-
getFields
java.util.List<Field> getFields()
Returns the list of fields associated with the record.- Returns:
- the list of fields associated with the record.
-
getField
default java.lang.Object getField(Field field)
Retrieve the value of the provided field.- Parameters:
field- the field to retrieve the value- Returns:
- the value object
-
getField
java.lang.Object getField(java.lang.String fieldName)
Retrieve the value of the provided fieldName.- Parameters:
fieldName- the field name- Returns:
- the value object, or null if field doesn't exist
-
getSchemaType
default SchemaType getSchemaType()
Return the schema tyoe.- Specified by:
getSchemaTypein interfaceGenericObject- Returns:
- the schema type
- Throws:
java.lang.UnsupportedOperationException- if this feature is not implemented- See Also:
SchemaType.AVRO,SchemaType.PROTOBUF_NATIVE,SchemaType.JSON
-
getNativeObject
default java.lang.Object getNativeObject()
Return the internal native representation of the Record, like a AVRO GenericRecord.- Specified by:
getNativeObjectin interfaceGenericObject- Returns:
- the internal representation of the record
- Throws:
java.lang.UnsupportedOperationException- if the operation is not supported
-
-