Top Fields Constructors Methods
tools.jackson.dataformat.avro.schema

public Class RecordVisitor

extends Base
implements SchemaBuilder
Class Inheritance
All Implemented Interfaces
tools.jackson.dataformat.avro.schema.SchemaBuilder
Imports
java.util.*, org.apache.avro.LogicalTypes, .Schema, .Schema.Type, org.apache.avro.reflect.AvroMeta, .AvroSchema, tools.jackson.databind.*, tools.jackson.databind.introspect.AnnotatedClass, tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitable, .JsonObjectFormatVisitor, tools.jackson.databind.jsontype.NamedType, tools.jackson.databind.ser.BeanPropertyWriter, tools.jackson.dataformat.avro.AvroFactory, .AvroWriteFeature, tools.jackson.dataformat.avro.annotation.AvroDecimal, .AvroFixedSize, tools.jackson.dataformat.avro.ser.CustomEncodingSerializer

Field Summary

Modifier and TypeField and Description
protected final Schema
protected final boolean
protected final List<Schema.Field>
protected final boolean
_overridden

Tracks if the schema for this record has been overridden (by an annotation or other means), and calls to the property and optionalProperty methods should be ignored.

protected final JavaType
private final Schema
_typeSchema

When Avro schema for this JavaType (_type) results in UNION of multiple Avro types, _typeSchema keeps track of which Avro type in the UNION represents this JavaType (_type) so that fields of this JavaType can be set to the right Avro type by builtAvroSchema().

protected final VisitorFormatWrapperImpl
Inherited from tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.Base:
_provider

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Schema
private static List<Schema>
public void
public void
public void
public void
property(String name, JsonFormatVisitable handler, JavaType type)

Overrides tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.Base.property.

Implements tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.property.

Callback method called when a non-POJO property (typically something like an Enum entry of java.util.EnumMap type) is being traversed.

protected Schema

Returns:

A schema modified so the first branch matches the type of defaultValue; otherwise, schema is returned unmodified.
reorderUnionToMatchDefaultType
(Schema
Schema to reorder; If null or not a UNION, then it is returned unmodified.
schema
,
JsonNode
Default value to match with the union
defaultValue
)

A union schema with a default value must always have the schema branch corresponding to the default value first, or Avro will print a warning complaining that the default value is not compatible.

protected Schema.Field
schemaFieldForWriter(BeanProperty prop, boolean optional)

Inherited from tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.Base:
getContextsetContext

Field Detail

_avroSchemaback to summary
protected final Schema _avroSchema
_cfgAddNullDefaultsback to summary
protected final boolean _cfgAddNullDefaults
_fieldsback to summary
protected final List<Schema.Field> _fields
_overriddenback to summary
protected final boolean _overridden

Tracks if the schema for this record has been overridden (by an annotation or other means), and calls to the property and optionalProperty methods should be ignored.

_typeback to summary
protected final JavaType _type
_typeSchemaback to summary
private final Schema _typeSchema

When Avro schema for this JavaType (_type) results in UNION of multiple Avro types, _typeSchema keeps track of which Avro type in the UNION represents this JavaType (_type) so that fields of this JavaType can be set to the right Avro type by builtAvroSchema().
Example:

Since
2.19.1
_visitorWrapperback to summary
protected final VisitorFormatWrapperImpl _visitorWrapper

Constructor Detail

RecordVisitorback to summary
public RecordVisitor(SerializationContext ctxt, JavaType type, VisitorFormatWrapperImpl visitorWrapper)

Method Detail

builtAvroSchemaback to summary
public Schema builtAvroSchema()

Implements tools.jackson.dataformat.avro.schema.SchemaBuilder.builtAvroSchema.

Annotations
@Override
deduplicateByReferenceback to summary
private static List<Schema> deduplicateByReference(List<Schema> schemas)
optionalPropertyback to summary
public void optionalProperty(BeanProperty writer)

Overrides tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.Base.optionalProperty.

Implements tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.optionalProperty.

Annotations
@Override
optionalPropertyback to summary
public void optionalProperty(String name, JsonFormatVisitable handler, JavaType type)

Overrides tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.Base.optionalProperty.

Implements tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.optionalProperty.

Annotations
@Override
propertyback to summary
public void property(BeanProperty writer)

Overrides tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.Base.property.

Implements tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.property.

Doc from tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.property.

Callback method called when a POJO property is being traversed.

Annotations
@Override
propertyback to summary
public void property(String name, JsonFormatVisitable handler, JavaType type)

Overrides tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.Base.property.

Implements tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.property.

Doc from tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.property.

Callback method called when a non-POJO property (typically something like an Enum entry of java.util.EnumMap type) is being traversed. With POJOs, property(BeanProperty) is called instead.

Annotations
@Override
reorderUnionToMatchDefaultTypeback to summary
protected Schema reorderUnionToMatchDefaultType(Schema schema, JsonNode defaultValue)

A union schema with a default value must always have the schema branch corresponding to the default value first, or Avro will print a warning complaining that the default value is not compatible. If schema is a UNION schema and defaultValue is non-null, this finds the appropriate branch in the union and reorders the union so that it is first.

Parameters
schema:Schema

Schema to reorder; If null or not a UNION, then it is returned unmodified.

defaultValue:JsonNode

Default value to match with the union

Returns:Schema

A schema modified so the first branch matches the type of defaultValue; otherwise, schema is returned unmodified.

schemaFieldForWriterback to summary
protected Schema.Field schemaFieldForWriter(BeanProperty prop, boolean optional)