org.apache.avro

## Class SchemaBuilder.FieldAssembler<R>

- java.lang.Object
- - org.apache.avro.SchemaBuilder.FieldAssembler<R>

- Enclosing class:
    SchemaBuilder

      public static final class SchemaBuilder.FieldAssembler<R>
      extends Object

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `R` | `endRecord()` End adding fields to this record, returning control to the context that this record builder was created in.
    `SchemaBuilder.FieldBuilder<R>` | `name(String fieldName)` Add a field with the given name.
    `SchemaBuilder.FieldAssembler<R>` | `nullableBoolean(String fieldName, boolean defaultVal)` Shortcut for creating a nullable boolean field: a union of boolean and null with an boolean default.
    `SchemaBuilder.FieldAssembler<R>` | `nullableBytes(String fieldName, byte[] defaultVal)` Shortcut for creating a nullable bytes field: a union of bytes and null with a bytes default.
    `SchemaBuilder.FieldAssembler<R>` | `nullableDouble(String fieldName, double defaultVal)` Shortcut for creating a nullable double field: a union of double and null with a double default.
    `SchemaBuilder.FieldAssembler<R>` | `nullableFloat(String fieldName, float defaultVal)` Shortcut for creating a nullable float field: a union of float and null with a float default.
    `SchemaBuilder.FieldAssembler<R>` | `nullableInt(String fieldName, int defaultVal)` Shortcut for creating a nullable int field: a union of int and null with an int default.
    `SchemaBuilder.FieldAssembler<R>` | `nullableLong(String fieldName, long defaultVal)` Shortcut for creating a nullable long field: a union of long and null with a long default.
    `SchemaBuilder.FieldAssembler<R>` | `nullableString(String fieldName, String defaultVal)` Shortcut for creating a nullable string field: a union of string and null with a string default.
    `SchemaBuilder.FieldAssembler<R>` | `optionalBoolean(String fieldName)` Shortcut for creating an optional boolean field: a union of null and boolean with null default.
    `SchemaBuilder.FieldAssembler<R>` | `optionalBytes(String fieldName)` Shortcut for creating an optional bytes field: a union of null and bytes with null default.
    `SchemaBuilder.FieldAssembler<R>` | `optionalDouble(String fieldName)` Shortcut for creating an optional double field: a union of null and double with null default.
    `SchemaBuilder.FieldAssembler<R>` | `optionalFloat(String fieldName)` Shortcut for creating an optional float field: a union of null and float with null default.
    `SchemaBuilder.FieldAssembler<R>` | `optionalInt(String fieldName)` Shortcut for creating an optional int field: a union of null and int with null default.
    `SchemaBuilder.FieldAssembler<R>` | `optionalLong(String fieldName)` Shortcut for creating an optional long field: a union of null and long with null default.
    `SchemaBuilder.FieldAssembler<R>` | `optionalString(String fieldName)` Shortcut for creating an optional string field: a union of null and string with null default.
    `SchemaBuilder.FieldAssembler<R>` | `requiredBoolean(String fieldName)` Shortcut for creating a boolean field with the given name and no default.
    `SchemaBuilder.FieldAssembler<R>` | `requiredBytes(String fieldName)` Shortcut for creating a bytes field with the given name and no default.
    `SchemaBuilder.FieldAssembler<R>` | `requiredDouble(String fieldName)` Shortcut for creating a double field with the given name and no default.
    `SchemaBuilder.FieldAssembler<R>` | `requiredFloat(String fieldName)` Shortcut for creating a float field with the given name and no default.
    `SchemaBuilder.FieldAssembler<R>` | `requiredInt(String fieldName)` Shortcut for creating an int field with the given name and no default.
    `SchemaBuilder.FieldAssembler<R>` | `requiredLong(String fieldName)` Shortcut for creating a long field with the given name and no default.
    `SchemaBuilder.FieldAssembler<R>` | `requiredString(String fieldName)` Shortcut for creating a string field with the given name and no default.

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

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

- - ### Method Detail

    - #### name

          public SchemaBuilder.FieldBuilder<R> name(String fieldName)

      Add a field with the given name.
      Returns:
        A `SchemaBuilder.FieldBuilder` for the given name.

    - #### requiredBoolean

          public SchemaBuilder.FieldAssembler<R> requiredBoolean(String fieldName)

      Shortcut for creating a boolean field with the given name and no default.

      This is equivalent to:

           name(fieldName).type().booleanType().noDefault()

    - #### optionalBoolean

          public SchemaBuilder.FieldAssembler<R> optionalBoolean(String fieldName)

      Shortcut for creating an optional boolean field: a union of null and boolean with null default.

      This is equivalent to:

           name(fieldName).type().optional().booleanType()

    - #### nullableBoolean

          public SchemaBuilder.FieldAssembler<R> nullableBoolean(String fieldName,
                                                                 boolean defaultVal)

      Shortcut for creating a nullable boolean field: a union of boolean and null with an boolean default.

      This is equivalent to:

           name(fieldName).type().nullable().booleanType().booleanDefault(defaultVal)

    - #### requiredInt

          public SchemaBuilder.FieldAssembler<R> requiredInt(String fieldName)

      Shortcut for creating an int field with the given name and no default.

      This is equivalent to:

           name(fieldName).type().intType().noDefault()

    - #### optionalInt

          public SchemaBuilder.FieldAssembler<R> optionalInt(String fieldName)

      Shortcut for creating an optional int field: a union of null and int with null default.

      This is equivalent to:

           name(fieldName).type().optional().intType()

    - #### nullableInt

          public SchemaBuilder.FieldAssembler<R> nullableInt(String fieldName,
                                                             int defaultVal)

      Shortcut for creating a nullable int field: a union of int and null with an int default.

      This is equivalent to:

           name(fieldName).type().nullable().intType().intDefault(defaultVal)

    - #### requiredLong

          public SchemaBuilder.FieldAssembler<R> requiredLong(String fieldName)

      Shortcut for creating a long field with the given name and no default.

      This is equivalent to:

           name(fieldName).type().longType().noDefault()

    - #### optionalLong

          public SchemaBuilder.FieldAssembler<R> optionalLong(String fieldName)

      Shortcut for creating an optional long field: a union of null and long with null default.

      This is equivalent to:

           name(fieldName).type().optional().longType()

    - #### nullableLong

          public SchemaBuilder.FieldAssembler<R> nullableLong(String fieldName,
                                                              long defaultVal)

      Shortcut for creating a nullable long field: a union of long and null with a long default.

      This is equivalent to:

           name(fieldName).type().nullable().longType().longDefault(defaultVal)

    - #### requiredFloat

          public SchemaBuilder.FieldAssembler<R> requiredFloat(String fieldName)

      Shortcut for creating a float field with the given name and no default.

      This is equivalent to:

           name(fieldName).type().floatType().noDefault()

    - #### optionalFloat

          public SchemaBuilder.FieldAssembler<R> optionalFloat(String fieldName)

      Shortcut for creating an optional float field: a union of null and float with null default.

      This is equivalent to:

           name(fieldName).type().optional().floatType()

    - #### nullableFloat

          public SchemaBuilder.FieldAssembler<R> nullableFloat(String fieldName,
                                                               float defaultVal)

      Shortcut for creating a nullable float field: a union of float and null with a float default.

      This is equivalent to:

           name(fieldName).type().nullable().floatType().floatDefault(defaultVal)

    - #### requiredDouble

          public SchemaBuilder.FieldAssembler<R> requiredDouble(String fieldName)

      Shortcut for creating a double field with the given name and no default.

      This is equivalent to:

           name(fieldName).type().doubleType().noDefault()

    - #### optionalDouble

          public SchemaBuilder.FieldAssembler<R> optionalDouble(String fieldName)

      Shortcut for creating an optional double field: a union of null and double with null default.

      This is equivalent to:

           name(fieldName).type().optional().doubleType()

    - #### nullableDouble

          public SchemaBuilder.FieldAssembler<R> nullableDouble(String fieldName,
                                                                double defaultVal)

      Shortcut for creating a nullable double field: a union of double and null with a double default.

      This is equivalent to:

           name(fieldName).type().nullable().doubleType().doubleDefault(defaultVal)

    - #### requiredString

          public SchemaBuilder.FieldAssembler<R> requiredString(String fieldName)

      Shortcut for creating a string field with the given name and no default.

      This is equivalent to:

           name(fieldName).type().stringType().noDefault()

    - #### optionalString

          public SchemaBuilder.FieldAssembler<R> optionalString(String fieldName)

      Shortcut for creating an optional string field: a union of null and string with null default.

      This is equivalent to:

           name(fieldName).type().optional().stringType()

    - #### nullableString

          public SchemaBuilder.FieldAssembler<R> nullableString(String fieldName,
                                                                String defaultVal)

      Shortcut for creating a nullable string field: a union of string and null with a string default.

      This is equivalent to:

           name(fieldName).type().nullable().stringType().stringDefault(defaultVal)

    - #### requiredBytes

          public SchemaBuilder.FieldAssembler<R> requiredBytes(String fieldName)

      Shortcut for creating a bytes field with the given name and no default.

      This is equivalent to:

           name(fieldName).type().bytesType().noDefault()

    - #### optionalBytes

          public SchemaBuilder.FieldAssembler<R> optionalBytes(String fieldName)

      Shortcut for creating an optional bytes field: a union of null and bytes with null default.

      This is equivalent to:

           name(fieldName).type().optional().bytesType()

    - #### nullableBytes

          public SchemaBuilder.FieldAssembler<R> nullableBytes(String fieldName,
                                                               byte[] defaultVal)

      Shortcut for creating a nullable bytes field: a union of bytes and null with a bytes default.

      This is equivalent to:

           name(fieldName).type().nullable().bytesType().bytesDefault(defaultVal)

    - #### endRecord

          public R endRecord()

      End adding fields to this record, returning control to the context that this record builder was created in.

Copyright © 2009–2024 The Apache Software Foundation. All rights reserved.