org.apache.avro.specific

## Class SpecificRecordBase

- java.lang.Object
- - org.apache.avro.specific.SpecificRecordBase

All Implemented Interfaces:
  Externalizable, Serializable, Comparable<SpecificRecord>, GenericContainer, GenericRecord, IndexedRecord, SpecificRecord

    public abstract class SpecificRecordBase
    extends Object
    implements SpecificRecord, Comparable<SpecificRecord>, GenericRecord, Externalizable

Base class for generated record classes.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`SpecificRecordBase()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`int` `compareTo(SpecificRecord that)`
`void` `customDecode(ResolvingDecoder in)`
`void` `customEncode(Encoder out)`
`boolean` `equals(Object that)`
`abstract Object` `get(int field)` Return the value of a field given its position in the schema.
`Object` `get(String fieldName)` Return the value of a field given its name.
`Conversion<?>` `getConversion(int field)`
`Conversion<?>` `getConversion(String fieldName)`
`abstract Schema` `getSchema()` The schema of this instance.
`SpecificData` `getSpecificData()`
`protected boolean` `hasCustomCoders()` Returns true iff an instance supports the `MessageEncoder.encode(D)` and `MessageDecoder.decode(java.io.InputStream)` operations.
`int` `hashCode()`
`abstract void` `put(int field, Object value)` Set the value of a field given its position in the schema.
`void` `put(String fieldName, Object value)` Set the value of a field given its name.
`void` `readExternal(ObjectInput in)`
`String` `toString()`
`void` `writeExternal(ObjectOutput out)`

### 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 Detail

#### SpecificRecordBase

    public SpecificRecordBase()

### Method Detail

#### getSchema

    public abstract Schema getSchema()

Description copied from interface: `GenericContainer`
The schema of this instance.

Specified by:
  `getSchema` in interface `GenericContainer`

#### get

    public abstract Object get(int field)

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`

#### put

    public abstract void put(int field,
                             Object value)

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`

#### getSpecificData

    public SpecificData getSpecificData()

#### getConversion

    public Conversion<?> getConversion(int field)

#### put

    public void put(String fieldName,
                    Object value)

Description copied from interface: `GenericRecord`
Set the value of a field given its name.

Specified by:
  `put` in interface `GenericRecord`

#### get

    public Object get(String fieldName)

Description copied from interface: `GenericRecord`
Return the value of a field given its name.

Specified by:
  `get` in interface `GenericRecord`

#### getConversion

    public Conversion<?> getConversion(String fieldName)

#### equals

    public boolean equals(Object that)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### compareTo

    public int compareTo(SpecificRecord that)

Specified by:
  `compareTo` in interface `Comparable<SpecificRecord>`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`

#### hasCustomCoders

    protected boolean hasCustomCoders()

Returns true iff an instance supports the `MessageEncoder.encode(D)` and `MessageDecoder.decode(java.io.InputStream)` operations. Should only be used by `SpecificDatumReader/Writer` to selectively use `customEncode(org.apache.avro.io.Encoder)` and `customDecode(org.apache.avro.io.ResolvingDecoder)` to optimize the (de)serialization of values.

#### customEncode

    public void customEncode(Encoder out)
                      throws IOException

Throws:
  `IOException`

#### customDecode

    public void customDecode(ResolvingDecoder in)
                      throws IOException

Throws:
  `IOException`