Interface SchemaDefinitionBuilder<T>
-
@Public @Stable public interface SchemaDefinitionBuilder<T>
Builder to build schema definitionSchemaDefinition
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SchemaDefinitionBuilder<T>
addProperty(java.lang.String key, java.lang.String value)
Set schema info properties.SchemaDefinition<T>
build()
Build the schema definition.SchemaDefinitionBuilder<T>
withAlwaysAllowNull(boolean alwaysAllowNull)
Set schema whether always allow null or not.SchemaDefinitionBuilder<T>
withJsonDef(java.lang.String jsonDefinition)
Set schema of json definition.SchemaDefinitionBuilder<T>
withJSR310ConversionEnabled(boolean jsr310ConversionEnabled)
Set schema use JRS310 conversion or not.SchemaDefinitionBuilder<T>
withPojo(java.lang.Class pojo)
Set schema of pojo definition.SchemaDefinitionBuilder<T>
withProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Set schema info properties.SchemaDefinitionBuilder<T>
withSchemaReader(SchemaReader<T> reader)
Set schema reader for deserialization of object data.SchemaDefinitionBuilder<T>
withSchemaWriter(SchemaWriter<T> writer)
Set schema writer for serialization of objects.SchemaDefinitionBuilder<T>
withSupportSchemaVersioning(boolean supportSchemaVersioning)
Set schema whether decode by schema version.
-
-
-
Method Detail
-
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(java.util.Map<java.lang.String,java.lang.String> properties)
Set schema info properties.- Parameters:
properties
- schema info properties- Returns:
- schema definition builder
-
addProperty
SchemaDefinitionBuilder<T> addProperty(java.lang.String key, java.lang.String value)
Set schema info properties.- Parameters:
key
- property keyvalue
- property value- Returns:
- schema definition builder
-
withPojo
SchemaDefinitionBuilder<T> withPojo(java.lang.Class pojo)
Set schema of pojo definition.- Parameters:
pojo
- pojo schema definition- Returns:
- schema definition builder
-
withJsonDef
SchemaDefinitionBuilder<T> withJsonDef(java.lang.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
SchemaDefinition<T> build()
Build the schema definition.- Returns:
- the schema definition.
-
-