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.
  • Method Details

    • unionOf

      Build an Avro union schema type.
    • 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

      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()