Package org.apache.avro.generic

# Class GenericData.Record

java.lang.Object
org.apache.avro.generic.GenericData.Record

All Implemented Interfaces:
  `Comparable<GenericData.Record>`, `GenericContainer`, `GenericRecord`, `IndexedRecord`

Enclosing class:
  `GenericData`

public static class GenericData.Record extends Object implements GenericRecord, Comparable<GenericData.Record>
Default implementation of `GenericRecord`. Note that this implementation does not fill in default values for fields if they are not specified; use `GenericRecordBuilder` in that case.

See Also:
  - `GenericRecordBuilder`

## Constructor Summary

Constructors
Constructor
Description
`Record(GenericData.Record other, boolean deepCopy)`
`Record(Schema schema)`

## Method Summary

Modifier and Type
Method
Description
`int`
`compareTo(GenericData.Record that)`
`boolean`
`equals(Object o)`
`Object`
`get(int i)`
Return the value of a field given its position in the schema.
`Object`
`get(String key)`
Return the value of a field given its name.
`Schema`
`getSchema()`
The schema of this instance.
`int`
`hashCode()`
`void`
`put(int i, Object v)`
Set the value of a field given its position in the schema.
`void`
`put(String key, Object value)`
Set the value of a field given its name.
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.apache.avro.generic.GenericRecord

`hasField`

## Constructor Details

### Record

public Record(Schema schema)

### Record

public Record(GenericData.Record other, boolean deepCopy)

## Method Details

### getSchema

public Schema getSchema()
Description copied from interface: `GenericContainer`
The schema of this instance.

Specified by:
  `getSchema` in interface `GenericContainer`

### put

public void put(String key, Object value)
Description copied from interface: `GenericRecord`
Set the value of a field given its name.

Specified by:
  `put` in interface `GenericRecord`

### put

public void put(int i, Object v)
Description copied from interface: `IndexedRecord`
Set the value of a field given its position in the schema.

This method is not meant to be called by user code, but only by `DatumReader` implementations.

Specified by:
  `put` in interface `IndexedRecord`

### get

public Object get(String key)
Description copied from interface: `GenericRecord`
Return the value of a field given its name.

Specified by:
  `get` in interface `GenericRecord`

### get

public Object get(int i)
Description copied from interface: `IndexedRecord`
Return the value of a field given its position in the schema.

This method is not meant to be called by user code, but only by `DatumWriter` implementations.

Specified by:
  `get` in interface `IndexedRecord`

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### compareTo

public int compareTo(GenericData.Record that)

Specified by:
  `compareTo` in interface `Comparable<GenericData.Record>`

### toString

public String toString()

Overrides:
  `toString` in class `Object`