Class GenericUnion

A generic container for unions.

class GenericUnion
  : GenericContainer ;

A union consists of several types, e.g. \["null", "int", "string" \], however, only a single union type is represented in data at any given moment. That is, an instance of the above union may contain the datum 3 or "apple" but not both.

Constructors

NameDescription
this (schema) Constructs a generic union corresponding to the given schema and the given value. The schema should be of Avro type union and the value should correspond to one of the union types.

Methods

NameDescription
getDatum () Returns the datum corresponding to the currently selected union type.
getUnionIndex () Returns the index of the current branch.
setUnionIndex (index) Selects a new branch. The type for the value is changed accordingly.