Interface FieldSchemaBuilder<T extends FieldSchemaBuilder<T>>


  • @Public
    @Stable
    public interface FieldSchemaBuilder<T extends FieldSchemaBuilder<T>>
    Build a field for a record.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      T aliases​(java.lang.String... aliases)
      The optional name aliases of this field.
      T defaultValue​(java.lang.Object value)
      Set the default value of this field.
      T doc​(java.lang.String doc)
      The documentation of this field.
      T optional()
      Make this field optional.
      T property​(java.lang.String name, java.lang.String val)
      Set name-value pair properties for this field.
      T required()
      Make this field required.
      T type​(SchemaType type)
      The type of this field.
    • Method Detail

      • property

        T property​(java.lang.String name,
                   java.lang.String val)
        Set name-value pair properties for this field.
        Parameters:
        name - name of the property
        val - value of the property
        Returns:
        field schema builder
      • doc

        T doc​(java.lang.String doc)
        The documentation of this field.
        Parameters:
        doc - documentation
        Returns:
        field schema builder
      • aliases

        T aliases​(java.lang.String... aliases)
        The optional name aliases of this field.
        Parameters:
        aliases - the name aliases of this field
        Returns:
        field schema builder
      • type

        T type​(SchemaType type)
        The type of this field.

        Currently only primitive types are supported.

        Parameters:
        type - schema type of this field
        Returns:
        field schema builder
      • optional

        T optional()
        Make this field optional.
        Returns:
        field schema builder
      • required

        T required()
        Make this field required.
        Returns:
        field schema builder
      • defaultValue

        T defaultValue​(java.lang.Object value)
        Set the default value of this field.

        The value is validated against the schema type.

        Returns:
        value