Class GenericUnion
A generic container for unions.
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
Name | Description |
---|---|
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
Name | Description |
---|---|
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. |