Interface SchemaDefinitionBuilder<T>


@Public @Stable public interface SchemaDefinitionBuilder<T>
Builder to build schema definition SchemaDefinition.
  • Method Details

    • withAlwaysAllowNull

      SchemaDefinitionBuilder<T> withAlwaysAllowNull(boolean alwaysAllowNull)
      Set schema whether always allow null or not.
      Parameters:
      alwaysAllowNull - definition null or not
      Returns:
      schema definition builder
    • withJSR310ConversionEnabled

      SchemaDefinitionBuilder<T> withJSR310ConversionEnabled(boolean jsr310ConversionEnabled)
      Set schema use JRS310 conversion or not.

      Before Avro 1.9 the Joda time library was used for handling the logical date(time) values. But since the introduction of Java8 the Java Specification Request (JSR) 310 has been included, which greatly improves the handling of date and time natively. To keep forwarding compatibility, default is use Joda time conversion.

      JSR310 conversion is recommended here. Joda time conversion is has been marked deprecated. In future versions, joda time conversion may be removed

      Parameters:
      jsr310ConversionEnabled - use JRS310 conversion or not, default is false for keep forwarding compatibility
      Returns:
      schema definition builder
    • withProperties

      SchemaDefinitionBuilder<T> withProperties(Map<String,String> properties)
      Set schema info properties.
      Parameters:
      properties - schema info properties
      Returns:
      schema definition builder
    • addProperty

      SchemaDefinitionBuilder<T> addProperty(String key, String value)
      Set schema info properties.
      Parameters:
      key - property key
      value - property value
      Returns:
      schema definition builder
    • withPojo

      SchemaDefinitionBuilder<T> withPojo(Class pojo)
      Set schema of pojo definition.
      Parameters:
      pojo - pojo schema definition
      Returns:
      schema definition builder
    • withClassLoader

      SchemaDefinitionBuilder<T> withClassLoader(ClassLoader classLoader)
      Set schema of pojo classLoader.
      Parameters:
      classLoader - pojo classLoader
      Returns:
      schema definition builder
    • withJsonDef

      SchemaDefinitionBuilder<T> withJsonDef(String jsonDefinition)
      Set schema of json definition.
      Parameters:
      jsonDefinition - json schema definition
      Returns:
      schema definition builder
    • withSupportSchemaVersioning

      SchemaDefinitionBuilder<T> withSupportSchemaVersioning(boolean supportSchemaVersioning)
      Set schema whether decode by schema version.
      Parameters:
      supportSchemaVersioning - decode by version
      Returns:
      schema definition builder
    • withSchemaReader

      SchemaDefinitionBuilder<T> withSchemaReader(SchemaReader<T> reader)
      Set schema reader for deserialization of object data.
      Parameters:
      reader - reader for object data
      Returns:
      schema definition builder
    • withSchemaWriter

      SchemaDefinitionBuilder<T> withSchemaWriter(SchemaWriter<T> writer)
      Set schema writer for serialization of objects.
      Parameters:
      writer - writer for objects
      Returns:
      schema definition builder
    • build

      Build the schema definition.
      Returns:
      the schema definition.