org.apache.avro

## Class Resolver.ReaderUnion

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

Enclosing class:
  Resolver

    public static class Resolver.ReaderUnion
    extends Resolver.Action

In this case, the reader is a union and the writer is not. For this case, we need to pick the first branch of the reader that matches the writer and pretend to the reader that the index of this branch was found in the writer's data stream. To support this case, the `Resolver.ReaderUnion` object has two (public) fields: `firstMatch` gives the index of the first matching branch in the reader's schema, and `actualResolution` is the `Resolver.Action` that resolves the writer's schema with the schema found in the `firstMatch` branch of the reader's schema.

### Nested Class Summary

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

`Resolver.Action.Type`

### Field Summary

Fields
`Resolver.Action` `actualAction`
`int` `firstMatch`

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

`conversion, logicalType, reader, type, writer`

### Constructor Summary

Constructors
Constructor and Description
`ReaderUnion(Schema w, Schema r, GenericData d, int firstMatch, Resolver.Action actual)`

### Method Summary

All Methods Static Methods Concrete Methods
`static Resolver.Action` `resolve(Schema w, Schema r, GenericData d, Map<Schema.SeenPair,Resolver.Action> seen)` Returns a `Resolver.ReaderUnion` action for resolving `w` and `r`, or an `Resolver.ErrorAction` if there is no branch in the reader that matches the writer.

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

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

### Field Detail

#### firstMatch

    public final int firstMatch

#### actualAction

    public final Resolver.Action actualAction

### Constructor Detail

#### ReaderUnion

    public ReaderUnion(Schema w,
                       Schema r,
                       GenericData d,
                       int firstMatch,
                       Resolver.Action actual)

### Method Detail

#### resolve

    public static Resolver.Action resolve(Schema w,
                                          Schema r,
                                          GenericData d,
                                          Map<Schema.SeenPair,Resolver.Action> seen)

Returns a `Resolver.ReaderUnion` action for resolving `w` and `r`, or an `Resolver.ErrorAction` if there is no branch in the reader that matches the writer.

Throws:
  `RuntimeException` - if `r` is not a union schema or `w` is a union schema