org.apache.avro

## Class Resolver.RecordAdjust

- java.lang.Object
- - org.apache.avro.Resolver.Action
  - - org.apache.avro.Resolver.RecordAdjust

- Enclosing class:
    Resolver

      public static class Resolver.RecordAdjust
      extends Resolver.Action

  Instructions for resolving two record schemas. Includes instructions on how to recursively resolve each field, an indication of when to skip (writer fields), plus information about which reader fields should be populated by defaults (because the writer doesn't have corresponding fields).

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.avro.Resolver.Action

      `Resolver.Action.Type`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `Object[]` | `defaults` Contains the default values to be used for the last `readerOrder.length-firstDefault` fields in rearderOrder.
    `Resolver.Action[]` | `fieldActions` An action for each field of the writer.
    `int` | `firstDefault` Pointer into `readerOrder` of the first reader field whose value comes from a default value.
    `GenericData.InstanceSupplier` | `instanceSupplier` Supplier that offers an optimized alternative to data.newRecord()
    `Schema.Field[]` | `readerOrder` Contains (all of) the reader's fields.

    - ### Fields inherited from class org.apache.avro.Resolver.Action

      `conversion, logicalType, reader, type, writer`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `noReorder()` Returns true iff `i == readerOrder[i].pos()` for all indices `i`.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### fieldActions

          public final Resolver.Action[] fieldActions

      An action for each field of the writer. If the corresponding field is to be skipped during reading, then this will contain a `Resolver.Skip`. For fields to be read into the reading datum, will contain a regular action for resolving the writer/reader schemas of the matching fields.

    - #### readerOrder

          public final Schema.Field[] readerOrder

      Contains (all of) the reader's fields. The first n of these are the fields that will be read from the writer: these n are in the order dictated by writer's schema. The remaining m fields will be read from default values (actions for these default values are found in `defaults`.

    - #### firstDefault

          public final int firstDefault

      Pointer into `readerOrder` of the first reader field whose value comes from a default value. Set to length of `readerOrder` if there are none.

    - #### defaults

          public final Object[] defaults

      Contains the default values to be used for the last `readerOrder.length-firstDefault` fields in rearderOrder. The `i`th element of `defaults` is the default value for the `i+firstDefault` member of `readerOrder`.

    - #### instanceSupplier

          public final GenericData.InstanceSupplier instanceSupplier

      Supplier that offers an optimized alternative to data.newRecord()

  - ### Method Detail

    - #### noReorder

          public boolean noReorder()

      Returns true iff `i == readerOrder[i].pos()` for all indices `i`. Which is to say: the order of the reader's fields is the same in both the reader's and writer's schema.

Copyright © 2009–2024 The Apache Software Foundation. All rights reserved.