org.apache.avro

## Class Resolver.EnumAdjust

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

- Enclosing class:
    Resolver

      public static class Resolver.EnumAdjust
      extends Resolver.Action

  Contains information needed to resolve enumerations. When resolving enums, adjustments need to be made in two scenarios: the index for an enum symbol might be different in the reader or writer, or the reader might not have a symbol that was written out for the writer (which is an error, but one we can only detect when decoding data). These adjustments are reflected in the instance variable `adjustments`. For the symbol with index `i` in the writer's enum definition, `adjustments[i]` -- and integer -- contains the adjustment for that symbol. If the integer is positive, then reader also has the symbol and the integer is its index in the reader's schema. If `adjustment[i]` is negative, then the reader does not have the corresponding symbol (which is the error case). Sometimes there's no adjustments needed: all symbols in the reader have the same index in the reader's and writer's schema. This is a common case, and it allows for some optimization. To signal that this is the case, `noAdjustmentsNeeded` is set to true.

- - ### 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
    --- | ---
    `int[]` | `adjustments`
    `boolean` | `noAdjustmentsNeeded`
    `Object[]` | `values`

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

      `conversion, logicalType, reader, type, writer`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Resolver.Action` | `resolve(Schema w, Schema r, GenericData d)` If writer and reader don't have same name, a `Resolver.ErrorAction.ErrorType.NAMES_DONT_MATCH` is returned, otherwise an appropriate `Resolver.EnumAdjust` is.

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

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

- - ### Field Detail

    - #### adjustments

          public final int[] adjustments

    - #### values

          public final Object[] values

    - #### noAdjustmentsNeeded

          public final boolean noAdjustmentsNeeded

  - ### Method Detail

    - #### resolve

          public static Resolver.Action resolve(Schema w,
                                                Schema r,
                                                GenericData d)

      If writer and reader don't have same name, a `Resolver.ErrorAction.ErrorType.NAMES_DONT_MATCH` is returned, otherwise an appropriate `Resolver.EnumAdjust` is.

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