org.apache.avro

## Class Resolver.Promote

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

- Enclosing class:
    Resolver

      public static class Resolver.Promote
      extends Resolver.Action

  In this case, the writer's type needs to be promoted to the reader's. These are constructed by `resolve(org.apache.avro.Schema, org.apache.avro.Schema, org.apache.avro.generic.GenericData)`, which will only construct one when the writer's and reader's schemas are different (ie, no "self promotion"), and whent the promotion is one allowed by the Avro spec.

- - ### Nested Class Summary

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

      `Resolver.Action.Type`

  - ### Field Summary

    - ### 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 boolean` | `isValid(Schema w, Schema r)` Returns true iff `w` and `r` are both primitive types and either they are the same type or `w` is promotable to `r`.
    `static Resolver.Action` | `resolve(Schema w, Schema r, GenericData d)` Return a promotion.

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

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

- - ### Method Detail

    - #### resolve

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

      Return a promotion.
      Parameters:
        `w` - Writer's schema
        `r` - Rearder's schema
      Returns:
        a `Resolver.Promote` schema if the two schemas are compatible, or `Resolver.ErrorAction.ErrorType.INCOMPATIBLE_SCHEMA_TYPES` if they are not.
      Throws:
        `IllegalArgumentException` - if getType() of the two schemas are not different.

    - #### isValid

          public static boolean isValid(Schema w,
                                        Schema r)

      Returns true iff `w` and `r` are both primitive types and either they are the same type or `w` is promotable to `r`. Should

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