Package org.apache.avro

# Class SchemaBuilder.FieldTypeBuilder<R>

java.lang.Object
org.apache.avro.SchemaBuilder.BaseFieldTypeBuilder<R>
org.apache.avro.SchemaBuilder.FieldTypeBuilder<R>

Enclosing class:
  `SchemaBuilder`

public static final class SchemaBuilder.FieldTypeBuilder<R> extends SchemaBuilder.BaseFieldTypeBuilder<R>
FieldTypeBuilder adds `unionOf()`, `nullable()`, and `optional()` to BaseFieldTypeBuilder.

## Field Summary

### Fields inherited from class org.apache.avro.SchemaBuilder.BaseFieldTypeBuilder

`bldr, names`

## Method Summary

Modifier and Type
Method
Description
`SchemaBuilder.BaseFieldTypeBuilder<R>`
`nullable()`
A shortcut for building a union of a type and null, with an optional default value of the non-null type.
`SchemaBuilder.BaseTypeBuilder<SchemaBuilder.FieldAssembler<R>>`
`optional()`
A shortcut for building a union of null and a type, with a null default.
`SchemaBuilder.UnionFieldTypeBuilder<R>`
`unionOf()`
Build an Avro union schema type.

### Methods inherited from class org.apache.avro.SchemaBuilder.BaseFieldTypeBuilder

`array, booleanBuilder, booleanType, bytesBuilder, bytesType, doubleBuilder, doubleType, enumeration, fixed, floatBuilder, floatType, intBuilder, intType, longBuilder, longType, map, nullBuilder, nullType, record, stringBuilder, stringType`

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

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

## Method Details

### unionOf

public SchemaBuilder.UnionFieldTypeBuilder<R> unionOf()
Build an Avro union schema type.

### nullable

public SchemaBuilder.BaseFieldTypeBuilder<R> nullable()
A shortcut for building a union of a type and null, with an optional default value of the non-null type.

For example, the two code snippets below are equivalent:

     nullable().booleanType().booleanDefault(true)

     unionOf().booleanType().and().nullType().endUnion().booleanDefault(true)

### optional

public SchemaBuilder.BaseTypeBuilder<SchemaBuilder.FieldAssembler<R>> optional()
A shortcut for building a union of null and a type, with a null default.

For example, the two code snippets below are equivalent:

     optional().booleanType()

     unionOf().nullType().and().booleanType().endUnion().nullDefault()